diff options
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 21 | 
1 files changed, 18 insertions, 3 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index e1c4e825d..02c19e011 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1214,7 +1214,8 @@ class DocumentItem(object):      def images(self):          if not hasattr(self, 'documents'):              return Document.objects.none() -        return self.documents.filter(image__isnull=False).exclude(image="") +        return self.documents.filter( +            image__isnull=False).exclude(image="").order_by("pk")      def get_extra_actions(self, request):          """ @@ -2735,6 +2736,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter):                    if getattr(self, attr)]          return slugify(u"-".join(values)) +    def docs_q(self): +        return Document.objects.filter(authors__person=self) +      def operation_docs_q(self):          return Document.objects.filter(              authors__person=self, operations__pk__isnull=False) @@ -3105,6 +3109,17 @@ class Document(OwnPerms, ImageModel, FullSearch):      BOOL_FIELDS = ['duplicate']      CACHED_LABELS = ['cache_related_label'] +    EXTRA_REQUEST_KEYS = { +        "operations": "operations__pk", +        "context_records": "context_records__pk", +        "context_records__operation": "context_records__operation__pk", +        "finds": "finds__pk", +        "finds__base_finds__context_record": +            "finds__base_finds__context_record__pk", +        "finds__base_finds__context_record__operation": +            "finds__base_finds__context_record__operation__pk", +        "authors__person": "authors__person__pk" +    }      title = models.TextField(_(u"Title"), blank=True, default='')      associated_file = models.FileField( @@ -3183,8 +3198,8 @@ class Document(OwnPerms, ImageModel, FullSearch):      @property      def images(self):          # mimic a queryset pointing to himself -        return Document.objects.filter(pk=self.pk, -                                       image__isnull=False).exclude(image='') +        return Document.objects.filter( +            pk=self.pk, image__isnull=False).exclude(image='')      @property      def has_related(self): | 
