diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 13 | 
1 files changed, 11 insertions, 2 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 020e66bfb..a3f61f713 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -33,7 +33,7 @@ from ishtar_common.utils import cached_label_changed  from ishtar_common.models import GeneralType, BaseHistorizedItem, \       HistoricalRecords, LightHistorizedItem, OwnPerms, Department, Source,\       Person, Organization, Town, Dashboard, IshtarUser, ValueGetter, \ -     DocumentTemplate +     DocumentTemplate, ShortMenuItem  FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS  class OperationType(GeneralType): @@ -132,7 +132,7 @@ class ArchaeologicalSite(BaseHistorizedItem):              name += u" %s %s" % (settings.JOINT, self.name)          return name -class Operation(BaseHistorizedItem, OwnPerms, ValueGetter): +class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem):      TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns',                    'associated_file_short_label', 'start_date',                    'excavation_end_date'] @@ -225,6 +225,12 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter):              ("close_operation", ugettext(u"Can close Operation")),          ) +    @classmethod +    def get_owns(cls, user): +        owns = super(Operation, cls).get_owns(user) +        #owns = owns.annotate(null_count=Count('operation_code')) +        return owns.order_by("-year", "operation_code") +      def __unicode__(self):          if self.cached_label:              return self.cached_label @@ -614,6 +620,9 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):          self._get_index()          super(AdministrativeAct, self).save(*args, **kwargs) +        if hasattr(self, 'associated_file') and self.associated_file: +            self.associated_file.update_has_admin_act() +            self.associated_file.update_short_menu_class()  class Parcel(LightHistorizedItem):      if FILES_AVAILABLE: | 
