diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/forms_common.py | 3 | ||||
| -rw-r--r-- | ishtar_common/tests.py | 8 | 
2 files changed, 8 insertions, 3 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index c6dbc9ae9..f0f29d0a0 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -2889,8 +2889,9 @@ class GISForm(forms.ModelForm, CustomForm, ManageOldType):          )      def save(self, commit=True): -        if not getattr(self.instance, "source_content_type", None): +        if not getattr(self.instance, "source_content_type_id", None):              self.instance.source_content_type_id = self.source_content_type +        if not getattr(self.instance, "source_id", None):              self.instance.source_id = self.source_id          item = super().save(commit=commit)          for related_key in models.GeoVectorData.RELATED_MODELS: diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 71bf38f28..ae115f654 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -2842,7 +2842,7 @@ class IshtarBasicTest(TestCase):          self.assertEqual(town.cached_label, "Sin City - 99 (2050)") -class GeoVectorTest(TestCase): +class GeoVectorFormTest(TestCase):      fixtures = FILE_FIXTURES      def setUp(self): @@ -2875,6 +2875,10 @@ class GeoVectorTest(TestCase):          self.app_source = "archaeological_operations"          self.model_source = "operation"          self.source_pk = self.operation.pk +        self.source_content_type_pk = ContentType.objects.get( +            app_label=self.app_source, +            model=self.model_source +        ).pk      def _test_get_create_geo(self, c, geom_type):          response = c.get(reverse( @@ -3280,7 +3284,7 @@ class GeoVectorTest(TestCase):      def _create_geo(self, geom_type):          geo_vector = models.GeoVectorData.objects.create( -            source_content_type_id=self.source_pk, +            source_content_type_id=self.source_content_type_pk,              source_id=self.source_pk,              name=f"Before edition geo {geom_type}",              origin=self.origin,  | 
