1 from functools import wraps
3 from django.db.models import Count
8 View decorator, which puts tab info on a request.
12 def wrapped(request, *args, **kwargs):
13 request.catalogue_active_tab = tab
14 return f(request, *args, **kwargs)
19 def cached_in_field(field_name):
23 def wrapped(self, *args, **kwargs):
24 value = getattr(self, field_name)
26 value = f(self, *args, **kwargs)
27 type(self)._default_manager.filter(pk=self.pk).update(**{field_name: value})