diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-11 19:04:54 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-11 19:04:54 +0200 |
| commit | 83868ab30af01e444fa46eeeafcb5027a2a4ed37 (patch) | |
| tree | f6e15f9d597e58122b1786fad748a7f481905e19 /archaeological_operations/models.py | |
| parent | bf816879ac151913cb45ce51b6136f3eafddfded (diff) | |
| parent | f102f5855c878f35a529aa6e1947e7516a1a67fa (diff) | |
| download | Ishtar-83868ab30af01e444fa46eeeafcb5027a2a4ed37.tar.bz2 Ishtar-83868ab30af01e444fa46eeeafcb5027a2a4ed37.zip | |
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 8 |
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) |
