summaryrefslogtreecommitdiff
path: root/archaeological_files/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r--archaeological_files/models.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 0095dd13b..2b739fb1c 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -29,7 +29,7 @@ from ishtar_common.utils import cached_label_changed
from ishtar_common.models import GeneralType, BaseHistorizedItem, \
HistoricalRecords, OwnPerms, Person, Organization, Department, Town, \
- Dashboard, IshtarUser
+ Dashboard, IshtarUser, ValueGetter
class FileType(GeneralType):
class Meta:
@@ -53,14 +53,14 @@ class PermitType(GeneralType):
ordering = ('label',)
if settings.COUNTRY == 'fr':
- class SaisineType(GeneralType):
+ class SaisineType(GeneralType, ValueGetter):
delay = models.IntegerField(_(u"Delay (in days)"))
class Meta:
verbose_name = u"Type Saisine"
verbose_name_plural = u"Types Saisine"
ordering = ('label',)
-class File(BaseHistorizedItem, OwnPerms):
+class File(BaseHistorizedItem, OwnPerms, ValueGetter):
TABLE_COLS = ['numeric_reference', 'year', 'internal_reference',
'file_type', 'saisine_type', 'towns', ]
year = models.IntegerField(_(u"Year"),
@@ -139,6 +139,14 @@ class File(BaseHistorizedItem, OwnPerms):
def get_total_number(cls):
return cls.objects.count()
+ def get_values(self, prefix=''):
+ values = super(File, self).get_values(prefix=prefix)
+ values['adminact_associated_file_towns_count'] = unicode(
+ self.towns.count())
+ values['adminact_associated_file_towns'] = u", ".join(
+ [unicode(town)for town in self.towns.all()])
+ return values
+
def __unicode__(self):
if self.cached_label:
return self.cached_label