diff options
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 79c9600dd..43677bca4 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -49,6 +49,7 @@ from ishtar_common.utils import ( get_image_path, get_columns_from_class, human_date, + SheetItem ) from simple_history.models import HistoricalRecords as BaseHistoricalRecords from simple_history.signals import ( @@ -1111,9 +1112,16 @@ class Imported(models.Model): return [] q = getattr(self, key) if user.is_superuser or user.ishtaruser.has_right("view_import"): - return list(q.all()) - q = q.filter(Q(user=user.ishtaruser) | Q(importer_type__users__pk=user.ishtaruser.pk)) - return list(q.all()) + lst = list(q.all()) + else: + lst = q.filter(Q(user=user.ishtaruser) | Q(importer_type__users__pk=user.ishtaruser.pk)) + new_lst = [] + for imprt in lst: + if imprt.group: + new_lst.append(imprt.group) + else: + new_lst.append(imprt) + return new_lst def get_imports(self, user): return self._get_imports(user, "imports") @@ -3102,7 +3110,7 @@ class ShortMenuItem: return "" -class MainItem(ShortMenuItem, SerializeItem): +class MainItem(ShortMenuItem, SerializeItem, SheetItem): """ Item with quick actions available from tables Extra actions are available from sheets @@ -3182,15 +3190,6 @@ class MainItem(ShortMenuItem, SerializeItem): except NoReverseMatch: return - def get_show_url(self): - show_url = self.SHOW_URL - if not show_url: - show_url = "show-" + self.__class__.__name__.lower() - try: - return reverse(show_url, args=[self.pk, ""]) - except NoReverseMatch: - return - @classmethod def get_columns(cls, table_cols_attr="TABLE_COLS", dict_col_labels=True): """ |