summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index f5a1ca8b0..701ae4593 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -174,6 +174,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
'start_date', 'excavation_end_date']
TABLE_COLS.insert(4, 'associated_file_short_label')
IMAGE_PREFIX = 'operations/'
+ SLUG = 'operation'
creation_date = models.DateField(_(u"Creation date"),
default=datetime.date.today)
end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
@@ -298,8 +299,11 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
ordering = ('cached_label',)
@classmethod
- def get_owns(cls, user):
- owns = super(Operation, cls).get_owns(user)
+ def get_owns(cls, user, menu_filtr=None):
+ extra_query = {}
+ if menu_filtr:
+ extra_query = {'associated_file': menu_filtr}
+ owns = super(Operation, cls).get_owns(user, extra_query=extra_query)
# owns = owns.annotate(null_count=Count('operation_code'))
# return owns.order_by("common_name", "-year", "operation_code")
return sorted(owns, key=lambda x: x.cached_label)