diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 13:41:02 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-22 13:41:02 +0200 |
commit | dafc5d16f3095bad00356b6198afcd5bbeab61d6 (patch) | |
tree | 7040d1fd325ba67b890122059a8f50a3857e332a /ishtar_common/models.py | |
parent | 64bb69c03ce1688c72b3f7ebd0e1550cd941aa69 (diff) | |
parent | 0ecd905165193897129a71a1e8203232f0b2b68c (diff) | |
download | Ishtar-dafc5d16f3095bad00356b6198afcd5bbeab61d6.tar.bz2 Ishtar-dafc5d16f3095bad00356b6198afcd5bbeab61d6.zip |
Merge branch 'master' into v0.9
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index ba3d51172..3453a53c5 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -608,9 +608,10 @@ class ItemKey(models.Model): class ImageModel(models.Model): - image = models.ImageField(upload_to="upload/", blank=True, null=True) + image = models.ImageField(upload_to="upload/", blank=True, null=True, + max_length=255) thumbnail = models.ImageField(upload_to='upload/thumbs/', blank=True, - null=True) + null=True, max_length=255) IMAGE_MAX_SIZE = settings.IMAGE_MAX_SIZE THUMB_MAX_SIZE = settings.THUMB_MAX_SIZE IMAGE_PREFIX = '/' @@ -794,6 +795,8 @@ class BaseHistorizedItem(Imported): pk=new_item.history_modifier_id) except User.ObjectDoesNotExist: pass + # force label regeneration + self._cached_label_checked = False self.save() except: raise HistoryError(u"The rollback has failed.") @@ -2253,6 +2256,14 @@ pre_delete.connect(pre_delete_import, sender=Import) class Organization(Address, Merge, OwnPerms, ValueGetter): TABLE_COLS = ('name', 'organization_type', 'town') SHOW_URL = 'show-organization' + + # search parameters + EXTRA_REQUEST_KEYS = { + 'name': 'name__icontains', + 'organization_type': 'organization_type__pk__in', + } + + # fields name = models.CharField(_(u"Name"), max_length=500) organization_type = models.ForeignKey(OrganizationType, verbose_name=_(u"Type")) @@ -2336,6 +2347,18 @@ class Person(Address, Merge, OwnPerms, ValueGetter): 'attached_to', 'town') SHOW_URL = 'show-person' MODIFY_URL = 'person_modify' + + # search parameters + REVERSED_BOOL_FIELDS = ['ishtaruser__isnull'] + EXTRA_REQUEST_KEYS = { + 'name': ['name__icontains', 'raw_name__icontains'], + 'surname': ['surname__icontains', 'raw_name__icontains'], + 'attached_to': 'attached_to__pk', + 'person_types': 'person_types__pk__in', + 'ishtaruser__isnull': 'ishtaruser__isnull' + } + + # fields old_title = models.CharField(_(u"Title"), max_length=100, choices=TYPE, blank=True, null=True) title = models.ForeignKey(TitleType, verbose_name=_(u"Title"), @@ -2527,6 +2550,19 @@ class IshtarUser(User): TABLE_COLS = ('username', 'person__name', 'person__surname', 'person__email', 'person__person_types_list', 'person__attached_to') + + # search parameters + EXTRA_REQUEST_KEYS = { + 'username': ['username__icontains'], + 'name': ['person__name__icontains', 'person__raw_name__icontains'], + 'surname': ['person__surname__icontains', + 'person__raw_name__icontains'], + 'email': ['person__email'], + 'attached_to': 'person__attached_to__pk', + 'person_types': 'person__person_types__pk__in', + } + + # fields person = models.ForeignKey(Person, verbose_name=_(u"Person"), unique=True, related_name='ishtaruser') advanced_shortcut_menu = models.BooleanField( |