diff options
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r-- | archaeological_finds/models_treatments.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index d8d51e28c..e94d1c272 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -171,7 +171,8 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): & Q(end_date__isnull=True) @classmethod - def get_owns(cls, user, menu_filtr=None, limit=None): + def get_owns(cls, user, menu_filtr=None, limit=None, values=None, + get_short_menu_class=None): replace_query = None if menu_filtr: if 'treatmentfile' in menu_filtr: @@ -184,10 +185,9 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): else: replace_query = q owns = super(Treatment, cls).get_owns( - user, replace_query=replace_query, limit=limit) - return sorted( - owns, key=lambda x: x.cached_label - if hasattr(x, 'cached_label') else unicode(x)) + user, replace_query=replace_query, limit=limit, + values=values, get_short_menu_class=get_short_menu_class) + return cls._return_get_owns(owns, values, get_short_menu_class) def get_query_operations(self): return Operation.objects.filter( @@ -531,11 +531,12 @@ class TreatmentFile(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, 'name') if getattr(self, attr)]) @classmethod - def get_owns(cls, user, menu_filtr=None, limit=None): - owns = super(TreatmentFile, cls).get_owns(user, limit=limit) - return sorted( - owns, key=lambda x: x.cached_label - if hasattr(x, 'cached_label') else unicode(x)) + def get_owns(cls, user, menu_filtr=None, limit=None, values=None, + get_short_menu_class=None): + owns = super(TreatmentFile, cls).get_owns( + user, limit=limit, values=values, + get_short_menu_class=get_short_menu_class) + return cls._return_get_owns(owns, values, get_short_menu_class) def _generate_cached_label(self): items = [unicode(getattr(self, k)) |