One citation bug fix (typo); change needed due to Django 1.3 security issue re: passing model to function
svn: r18583
This commit is contained in:
		@@ -20,7 +20,7 @@ Database information:</p>
 | 
			
		||||
   <tr class="{% cycle odd,even %}">
 | 
			
		||||
       {% if view.2 %}
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.0}}</a></td> 
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.2.objects.count|format_number}}</td>
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.1|table_count}}</td>
 | 
			
		||||
       {% endif %}
 | 
			
		||||
   </tr>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ Database information:</p>
 | 
			
		||||
   <tr class="{% cycle odd,even %}">
 | 
			
		||||
       {% if view.2 %}
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.0}}</a></td> 
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.2.objects.count|format_number}}</td>
 | 
			
		||||
          <td align="left"><a href="/{{view.1}}">{{view.1|table_count}}</td>
 | 
			
		||||
       {% endif %}
 | 
			
		||||
   </tr>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
 
 | 
			
		||||
@@ -297,7 +297,7 @@ class DbDjango(DbWriteBase, DbReadBase):
 | 
			
		||||
        in a format that contains a C/Python style format string using %d, 
 | 
			
		||||
        such as C%d or C%04d.
 | 
			
		||||
        """
 | 
			
		||||
        self.source_prefix = self._validated_id_prefix(val, "C")
 | 
			
		||||
        self.citation_prefix = self._validated_id_prefix(val, "C")
 | 
			
		||||
        self.cid2user_format = self.__id2user_format(self.citation_prefix)
 | 
			
		||||
            
 | 
			
		||||
    def set_source_id_prefix(self, val):
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,9 @@ register.filter('probably_alive', probably_alive)
 | 
			
		||||
format_number.is_safe = True
 | 
			
		||||
register.filter('format_number', format_number)
 | 
			
		||||
 | 
			
		||||
table_count.is_safe = True
 | 
			
		||||
register.filter('table_count', table_count)
 | 
			
		||||
 | 
			
		||||
person_get_birth_date.is_safe = True
 | 
			
		||||
register.filter('person_get_birth_date', person_get_birth_date)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -132,6 +132,33 @@ def format_number(number, with_grouping=True):
 | 
			
		||||
    else:
 | 
			
		||||
        return locale.format("%d", 0, with_grouping)
 | 
			
		||||
 | 
			
		||||
def table_count(table, with_grouping=True):
 | 
			
		||||
    # FIXME: should be user's setting
 | 
			
		||||
    locale.setlocale(locale.LC_ALL, "en_US.utf8")
 | 
			
		||||
    if table == "person":
 | 
			
		||||
        number = models.Person.objects.count()
 | 
			
		||||
    elif table == "family":
 | 
			
		||||
        number = models.Family.objects.count()
 | 
			
		||||
    elif table == "event":
 | 
			
		||||
        number = models.Event.objects.count()
 | 
			
		||||
    elif table == "note":
 | 
			
		||||
        number = models.Note.objects.count()
 | 
			
		||||
    elif table == "media":
 | 
			
		||||
        number = models.Media.objects.count()
 | 
			
		||||
    elif table == "citation":
 | 
			
		||||
        number = models.Citation.objects.count()
 | 
			
		||||
    elif table == "source":
 | 
			
		||||
        number = models.Source.objects.count()
 | 
			
		||||
    elif table == "place":
 | 
			
		||||
        number = models.Place.objects.count()
 | 
			
		||||
    elif table == "repository":
 | 
			
		||||
        number = models.Repository.objects.count()
 | 
			
		||||
    elif table == "tag":
 | 
			
		||||
        number = models.Tag.objects.count()
 | 
			
		||||
    else:
 | 
			
		||||
        return "[unknown table]"
 | 
			
		||||
    return locale.format("%d", number, with_grouping)
 | 
			
		||||
 | 
			
		||||
def nbsp(string):
 | 
			
		||||
    """
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user