diff options
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index e5e173654..ef7dc8a4e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -69,7 +69,7 @@ from ishtar_common.models_imports import ImporterModel, ImporterType, \      Import, TargetKeyGroup  from ishtar_common.utils import get_cache, disable_for_loaddata, create_slug, \      get_all_field_names, merge_tsvectors, cached_label_changed, \ -    generate_relation_graph, HISTORY_M2M_SPLIT +    generate_relation_graph  __all__ = [      'ImporterModel', 'ImporterType', 'ImporterDefault', 'ImporterDefaultValues', @@ -153,11 +153,10 @@ class HistoryModel(models.Model):          abstract = True      def m2m_listing(self, key): -        hist_value = getattr(self, "historical_" + key, None) -        if not hist_value: +        if not self.history_m2m or key not in self.history_m2m:              return          related_model = getattr(self, key).model -        return related_model.history_decompress(hist_value) +        return related_model.history_decompress(self.history_m2m[key])  class HistoricalRecords(BaseHistoricalRecords): @@ -539,7 +538,7 @@ class GeneralType(Cached, models.Model):          if not value:              return []          res = [] -        for txt_idx in value.split(HISTORY_M2M_SPLIT): +        for txt_idx in value:              try:                  res.append(cls.objects.get(txt_idx=txt_idx))              except cls.DoesNotExist: @@ -1481,6 +1480,7 @@ class BaseHistorizedItem(DocumentItem, FullSearch, Imported, JsonData,          User, related_name='+', on_delete=models.SET_NULL,          verbose_name=_(u"Creator"), blank=True, null=True)      last_modified = models.DateTimeField(auto_now=True) +    history_m2m = JSONField(default={}, blank=True)      class Meta:          abstract = True @@ -2827,6 +2827,7 @@ class OrganizationManager(models.Manager):  class Organization(Address, Merge, OwnPerms, ValueGetter):      TABLE_COLS = ('name', 'organization_type', 'town') +    SLUG = "organization"      SHOW_URL = 'show-organization'      # search parameters @@ -2954,6 +2955,7 @@ class PersonManager(models.Manager):  class Person(Address, Merge, OwnPerms, ValueGetter): +    SLUG = "person"      _prefix = 'person_'      TYPE = (          ('Mr', _(u'Mr')), | 
