summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/models_imports.py3
-rw-r--r--ishtar_common/tests.py13
2 files changed, 15 insertions, 1 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index fce25cedd..ea2f0f549 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -1407,7 +1407,8 @@ class BaseImport(models.Model):
q = cls.objects
if user.is_superuser:
return q
- ishtar_user = models.IshtarUser.objects.get(pk=user.pk)
+ IshtarUser = apps.get_model("ishtar_common", "IshtarUser")
+ ishtar_user = IshtarUser.objects.get(pk=user.pk)
q = q.filter(user=ishtar_user)
return q
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index f90def1d2..257036556 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -2790,6 +2790,19 @@ class ImportTest(BaseImportTest):
field = getattr(sub_import, k)
self.assertTrue(field, "{} is missing in unarchive".format(k))
+ def test_display_csv(self):
+ imprt = self.create_import()
+ username, password, __ = create_user("test", "test")
+ c = Client()
+ c.login(username=username, password=password)
+ url = "import_display_csv"
+ response = c.get(reverse(url, args=["source", "", imprt.pk]), )
+ self.assertEqual(response.status_code, 404)
+ username, password, __ = create_superuser()
+ c.login(username=username, password=password)
+ response = c.get(reverse(url, args=["source", "", imprt.pk]))
+ self.assertEqual(response.status_code, 200)
+
def test_delete_related(self):
town = models.Town.objects.create(name="my-test")
self.assertEqual(models.Town.objects.filter(name="my-test").count(), 1)