diff options
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index dc2fef815..5fa668faf 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1818,6 +1818,21 @@ class QRCodeItem(models.Model, ImageContainerModel): class DocumentItem(object): + ALT_NAMES = { + 'documents__image__isnull': + SearchAltName( + pgettext_lazy("key for text search", "has-image"), + 'documents__image__isnull'), + 'documents__associated_url__isnull': + SearchAltName( + pgettext_lazy("key for text search", "has-url"), + 'documents__associated_url__isnull'), + 'documents__associated_file__isnull': + SearchAltName( + pgettext_lazy("key for text search", "has-attached-file"), + 'documents__associated_file__isnull'), + } + def public_representation(self): images = [] if getattr(self, "main_image", None): @@ -5600,6 +5615,8 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel, no_path_change = 'no_path_change' in kwargs \ and kwargs.pop('no_path_change') self.set_index() + if not self.associated_url: + self.associated_url = None super(Document, self).save(*args, **kwargs) if self.image and not no_path_change and \ |