diff options
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c6643100f..a4fe5af7f 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -522,7 +522,7 @@ class GeneralType(Cached, models.Model):          return u""      @classmethod -    def _get_initial_types(cls, initial, type_pks): +    def _get_initial_types(cls, initial, type_pks, instance=False):          new_vals = []          if not initial:              return [] @@ -537,7 +537,10 @@ class GeneralType(Cached, models.Model):                  continue              try:                  extra_type = cls.objects.get(pk=pk) -                new_vals.append((extra_type.pk, unicode(extra_type))) +                if instance: +                    new_vals.append(extra_type) +                else: +                    new_vals.append((extra_type.pk, unicode(extra_type)))              except cls.DoesNotExist:                  continue          return new_vals @@ -2471,7 +2474,8 @@ class OperationType(GeneralType):              items = items.exclude(txt_idx__in=exclude)          current_preventive, current_lst = None, None          item_list = list(items.order_by(*cls._meta.ordering).all()) -        new_vals = cls._get_initial_types(initial, [i.pk for i in item_list]) +        new_vals = cls._get_initial_types(initial, [i.pk for i in item_list], +                                          instance=True)          item_list += new_vals          for item in item_list:              if not current_lst or item.preventive != current_preventive: | 
