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, 5 insertions, 3 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 926e27b3b..4dd107da8 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -212,7 +212,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
surface = models.IntegerField(_(u"Surface (m2)"), blank=True, null=True)
remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains'),
null=True, blank=True)
- towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"))
+ towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"),
+ related_name='operations')
cost = models.IntegerField(_(u"Cost (euros)"),
blank=True, null=True) # preventive
periods = models.ManyToManyField(Period, verbose_name=_(u"Periods"),
@@ -307,12 +308,13 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
ordering = ('cached_label',)
@classmethod
- def get_owns(cls, user, menu_filtr=None):
+ def get_owns(cls, user, menu_filtr=None, limit=None):
replace_query = {}
if menu_filtr:
replace_query = {'associated_file': menu_filtr}
owns = super(Operation, cls).get_owns(
- user, replace_query=replace_query)
+ user, replace_query=replace_query,
+ limit=limit)
# 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)