From 8cfb72eb956d2f70ec34e4886e83a8867831b9c4 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Mon, 22 Nov 2021 16:08:24 +0100 Subject: [PATCH 1/6] :sparkles: add has_geometry field --- src/objecttypes/api/serializers.py | 2 ++ src/objecttypes/api/v1/openapi.yaml | 6 +++++ src/objecttypes/api/v2/openapi.yaml | 6 +++++ src/objecttypes/core/admin.py | 2 +- .../0016_objecttype_has_geometry.py | 22 +++++++++++++++++++ src/objecttypes/core/models.py | 5 +++++ 6 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/objecttypes/core/migrations/0016_objecttype_has_geometry.py diff --git a/src/objecttypes/api/serializers.py b/src/objecttypes/api/serializers.py index fe535004..6d4355e2 100644 --- a/src/objecttypes/api/serializers.py +++ b/src/objecttypes/api/serializers.py @@ -95,6 +95,7 @@ class Meta: "labels", "createdAt", "modifiedAt", + "hasGeometry", "versions", ) extra_kwargs = { @@ -109,6 +110,7 @@ class Meta: "updateFrequency": {"source": "update_frequency"}, "providerOrganization": {"source": "provider_organization"}, "documentationUrl": {"source": "documentation_url"}, + "hasGeometry": {"source": "has_geometry"}, "createdAt": {"source": "created_at", "read_only": True}, "modifiedAt": {"source": "modified_at", "read_only": True}, } diff --git a/src/objecttypes/api/v1/openapi.yaml b/src/objecttypes/api/v1/openapi.yaml index 020779e6..108232b9 100644 --- a/src/objecttypes/api/v1/openapi.yaml +++ b/src/objecttypes/api/v1/openapi.yaml @@ -495,6 +495,9 @@ components: format: date readOnly: true description: Last date when the object type was modified + hasGeometry: + type: boolean + description: Shows whether the related objects have geographic coordinates versions: type: array items: @@ -634,6 +637,9 @@ components: format: date readOnly: true description: Last date when the object type was modified + hasGeometry: + type: boolean + description: Shows whether the related objects have geographic coordinates versions: type: array items: diff --git a/src/objecttypes/api/v2/openapi.yaml b/src/objecttypes/api/v2/openapi.yaml index 2ded6b48..93701985 100644 --- a/src/objecttypes/api/v2/openapi.yaml +++ b/src/objecttypes/api/v2/openapi.yaml @@ -515,6 +515,9 @@ components: format: date readOnly: true description: Last date when the object type was modified + hasGeometry: + type: boolean + description: Shows whether the related objects have geographic coordinates versions: type: array items: @@ -694,6 +697,9 @@ components: format: date readOnly: true description: Last date when the object type was modified + hasGeometry: + type: boolean + description: Shows whether the related objects have geographic coordinates versions: type: array items: diff --git a/src/objecttypes/core/admin.py b/src/objecttypes/core/admin.py index 1026de9a..0e3af50e 100644 --- a/src/objecttypes/core/admin.py +++ b/src/objecttypes/core/admin.py @@ -87,7 +87,7 @@ class Media: @admin.register(ObjectType) class ObjectTypeAdmin(admin.ModelAdmin): - list_display = ("name", "name_plural") + list_display = ("name", "name_plural", "has_geometry") search_fields = ("uuid",) inlines = [ObjectVersionInline] diff --git a/src/objecttypes/core/migrations/0016_objecttype_has_geometry.py b/src/objecttypes/core/migrations/0016_objecttype_has_geometry.py new file mode 100644 index 00000000..0bbed43a --- /dev/null +++ b/src/objecttypes/core/migrations/0016_objecttype_has_geometry.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.24 on 2021-11-22 14:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0015_auto_20201126_2007"), + ] + + operations = [ + migrations.AddField( + model_name="objecttype", + name="has_geometry", + field=models.BooleanField( + default=True, + help_text="Shows whether the related objects have geographic coordinates", + verbose_name="has geometry", + ), + ), + ] diff --git a/src/objecttypes/core/models.py b/src/objecttypes/core/models.py index bcf31f46..eeff578f 100644 --- a/src/objecttypes/core/models.py +++ b/src/objecttypes/core/models.py @@ -106,6 +106,11 @@ class ObjectType(models.Model): auto_now=True, help_text=_("Last date when the object type was modified"), ) + has_geometry = models.BooleanField( + _("has geometry"), + default=True, + help_text=_("Shows whether the related objects have geographic coordinates"), + ) def __str__(self): return f"{self.name}" From 08257ed1afdcccf7405d9e7d89f797d14c5eb9e3 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Mon, 22 Nov 2021 16:08:57 +0100 Subject: [PATCH 2/6] :white_check_mark: update tests with has_geometry field --- src/objecttypes/tests/v1/test_objecttype_api.py | 3 +++ src/objecttypes/tests/v2/test_objecttype_api.py | 1 + 2 files changed, 4 insertions(+) diff --git a/src/objecttypes/tests/v1/test_objecttype_api.py b/src/objecttypes/tests/v1/test_objecttype_api.py index 6645ba37..7081db3f 100644 --- a/src/objecttypes/tests/v1/test_objecttype_api.py +++ b/src/objecttypes/tests/v1/test_objecttype_api.py @@ -42,6 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", + "hasGeometry": object_type.has_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ], @@ -87,6 +88,7 @@ def test_create_objecttype(self): "providerOrganization": "tree provider", "documentationUrl": "http://example.com/doc/trees", "labels": {"key1": "value1"}, + "hasGeometry": False, } response = self.client.post(url, data) @@ -113,6 +115,7 @@ def test_create_objecttype(self): self.assertEqual(object_type.labels, {"key1": "value1"}) self.assertEqual(object_type.created_at, date(2020, 1, 1)) self.assertEqual(object_type.modified_at, date(2020, 1, 1)) + self.assertEqual(object_type.has_geometry, False) def test_update_objecttype(self): object_type = ObjectTypeFactory.create( diff --git a/src/objecttypes/tests/v2/test_objecttype_api.py b/src/objecttypes/tests/v2/test_objecttype_api.py index 6645ba37..6b190045 100644 --- a/src/objecttypes/tests/v2/test_objecttype_api.py +++ b/src/objecttypes/tests/v2/test_objecttype_api.py @@ -42,6 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", + "hasGeometry": object_type.has_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ], From bc7c14273dd7c07e2eeebe6ab0378be298b47f1a Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Mon, 22 Nov 2021 16:19:59 +0100 Subject: [PATCH 3/6] :green_heart: pin OAS linter in github actions --- .github/workflows/lint-oas.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-oas.yml b/.github/workflows/lint-oas.yml index 02ed19b0..f67c1497 100644 --- a/.github/workflows/lint-oas.yml +++ b/.github/workflows/lint-oas.yml @@ -25,6 +25,6 @@ jobs: with: node-version: '12' - name: Install spectral - run: npm install -g @stoplight/spectral + run: npm install -g @stoplight/spectral@5 - name: Run OAS linter run: spectral lint ./src/objecttypes/api/${{ matrix.version }}/openapi.yaml From 922002cdd0d0672d4a3050d963d5a1460607e1f0 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Fri, 26 Nov 2021 17:38:13 +0100 Subject: [PATCH 4/6] :memo: update 'has_geometry' description in OAS --- src/objecttypes/api/v1/openapi.yaml | 10 +++++++-- src/objecttypes/api/v2/openapi.yaml | 10 +++++++-- .../migrations/0017_auto_20211126_1736.py | 22 +++++++++++++++++++ src/objecttypes/core/models.py | 7 +++++- 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 src/objecttypes/core/migrations/0017_auto_20211126_1736.py diff --git a/src/objecttypes/api/v1/openapi.yaml b/src/objecttypes/api/v1/openapi.yaml index 108232b9..55577ebd 100644 --- a/src/objecttypes/api/v1/openapi.yaml +++ b/src/objecttypes/api/v1/openapi.yaml @@ -497,7 +497,10 @@ components: description: Last date when the object type was modified hasGeometry: type: boolean - description: Shows whether the related objects have geographic coordinates + description: 'Shows whether the related objects have geographic coordinates. + If the value is ''false'' the related objects are not allowed to have + coordinates and the creation/update of objects with `geometry` property + will raise an error ' versions: type: array items: @@ -639,7 +642,10 @@ components: description: Last date when the object type was modified hasGeometry: type: boolean - description: Shows whether the related objects have geographic coordinates + description: 'Shows whether the related objects have geographic coordinates. + If the value is ''false'' the related objects are not allowed to have + coordinates and the creation/update of objects with `geometry` property + will raise an error ' versions: type: array items: diff --git a/src/objecttypes/api/v2/openapi.yaml b/src/objecttypes/api/v2/openapi.yaml index 93701985..425429ca 100644 --- a/src/objecttypes/api/v2/openapi.yaml +++ b/src/objecttypes/api/v2/openapi.yaml @@ -517,7 +517,10 @@ components: description: Last date when the object type was modified hasGeometry: type: boolean - description: Shows whether the related objects have geographic coordinates + description: 'Shows whether the related objects have geographic coordinates. + If the value is ''false'' the related objects are not allowed to have + coordinates and the creation/update of objects with `geometry` property + will raise an error ' versions: type: array items: @@ -699,7 +702,10 @@ components: description: Last date when the object type was modified hasGeometry: type: boolean - description: Shows whether the related objects have geographic coordinates + description: 'Shows whether the related objects have geographic coordinates. + If the value is ''false'' the related objects are not allowed to have + coordinates and the creation/update of objects with `geometry` property + will raise an error ' versions: type: array items: diff --git a/src/objecttypes/core/migrations/0017_auto_20211126_1736.py b/src/objecttypes/core/migrations/0017_auto_20211126_1736.py new file mode 100644 index 00000000..7ed44f57 --- /dev/null +++ b/src/objecttypes/core/migrations/0017_auto_20211126_1736.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.24 on 2021-11-26 16:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0016_objecttype_has_geometry"), + ] + + operations = [ + migrations.AlterField( + model_name="objecttype", + name="has_geometry", + field=models.BooleanField( + default=True, + help_text="Shows whether the related objects have geographic coordinates. If the value is 'false' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ", + verbose_name="has geometry", + ), + ), + ] diff --git a/src/objecttypes/core/models.py b/src/objecttypes/core/models.py index eeff578f..60476032 100644 --- a/src/objecttypes/core/models.py +++ b/src/objecttypes/core/models.py @@ -109,7 +109,12 @@ class ObjectType(models.Model): has_geometry = models.BooleanField( _("has geometry"), default=True, - help_text=_("Shows whether the related objects have geographic coordinates"), + help_text=_( + "Shows whether the related objects have geographic coordinates. " + "If the value is 'false' the related objects are not allowed to " + "have coordinates and the creation/update of objects with " + "`geometry` property will raise an error " + ), ) def __str__(self): From 3c098f6ad2aa67f8c7325ab65ff5a0bef26b34ef Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Fri, 3 Dec 2021 12:27:45 +0100 Subject: [PATCH 5/6] :ok_hand: rename 'hasGeometry' to 'canHaveGeometry' --- src/objecttypes/api/serializers.py | 4 +-- src/objecttypes/core/admin.py | 2 +- .../migrations/0017_auto_20211126_1736.py | 22 ---------------- .../migrations/0017_auto_20211203_1225.py | 26 +++++++++++++++++++ src/objecttypes/core/models.py | 6 ++--- .../tests/v1/test_objecttype_api.py | 6 ++--- .../tests/v2/test_objecttype_api.py | 2 +- 7 files changed, 36 insertions(+), 32 deletions(-) delete mode 100644 src/objecttypes/core/migrations/0017_auto_20211126_1736.py create mode 100644 src/objecttypes/core/migrations/0017_auto_20211203_1225.py diff --git a/src/objecttypes/api/serializers.py b/src/objecttypes/api/serializers.py index 6d4355e2..832c87d4 100644 --- a/src/objecttypes/api/serializers.py +++ b/src/objecttypes/api/serializers.py @@ -95,7 +95,7 @@ class Meta: "labels", "createdAt", "modifiedAt", - "hasGeometry", + "canHaveGeometry", "versions", ) extra_kwargs = { @@ -110,7 +110,7 @@ class Meta: "updateFrequency": {"source": "update_frequency"}, "providerOrganization": {"source": "provider_organization"}, "documentationUrl": {"source": "documentation_url"}, - "hasGeometry": {"source": "has_geometry"}, + "canHaveGeometry": {"source": "can_have_geometry"}, "createdAt": {"source": "created_at", "read_only": True}, "modifiedAt": {"source": "modified_at", "read_only": True}, } diff --git a/src/objecttypes/core/admin.py b/src/objecttypes/core/admin.py index 0e3af50e..a71bad4b 100644 --- a/src/objecttypes/core/admin.py +++ b/src/objecttypes/core/admin.py @@ -87,7 +87,7 @@ class Media: @admin.register(ObjectType) class ObjectTypeAdmin(admin.ModelAdmin): - list_display = ("name", "name_plural", "has_geometry") + list_display = ("name", "name_plural", "can_have_geometry") search_fields = ("uuid",) inlines = [ObjectVersionInline] diff --git a/src/objecttypes/core/migrations/0017_auto_20211126_1736.py b/src/objecttypes/core/migrations/0017_auto_20211126_1736.py deleted file mode 100644 index 7ed44f57..00000000 --- a/src/objecttypes/core/migrations/0017_auto_20211126_1736.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.24 on 2021-11-26 16:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("core", "0016_objecttype_has_geometry"), - ] - - operations = [ - migrations.AlterField( - model_name="objecttype", - name="has_geometry", - field=models.BooleanField( - default=True, - help_text="Shows whether the related objects have geographic coordinates. If the value is 'false' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ", - verbose_name="has geometry", - ), - ), - ] diff --git a/src/objecttypes/core/migrations/0017_auto_20211203_1225.py b/src/objecttypes/core/migrations/0017_auto_20211203_1225.py new file mode 100644 index 00000000..ddd42b95 --- /dev/null +++ b/src/objecttypes/core/migrations/0017_auto_20211203_1225.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2.24 on 2021-12-03 11:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0016_objecttype_has_geometry"), + ] + + operations = [ + migrations.RemoveField( + model_name="objecttype", + name="has_geometry", + ), + migrations.AddField( + model_name="objecttype", + name="can_have_geometry", + field=models.BooleanField( + default=True, + help_text="Shows whether the related objects can have geographic coordinates. If the value is 'false' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ", + verbose_name="can have geometry", + ), + ), + ] diff --git a/src/objecttypes/core/models.py b/src/objecttypes/core/models.py index 60476032..991b66b2 100644 --- a/src/objecttypes/core/models.py +++ b/src/objecttypes/core/models.py @@ -106,11 +106,11 @@ class ObjectType(models.Model): auto_now=True, help_text=_("Last date when the object type was modified"), ) - has_geometry = models.BooleanField( - _("has geometry"), + can_have_geometry = models.BooleanField( + _("can have geometry"), default=True, help_text=_( - "Shows whether the related objects have geographic coordinates. " + "Shows whether the related objects can have geographic coordinates. " "If the value is 'false' the related objects are not allowed to " "have coordinates and the creation/update of objects with " "`geometry` property will raise an error " diff --git a/src/objecttypes/tests/v1/test_objecttype_api.py b/src/objecttypes/tests/v1/test_objecttype_api.py index 7081db3f..863da257 100644 --- a/src/objecttypes/tests/v1/test_objecttype_api.py +++ b/src/objecttypes/tests/v1/test_objecttype_api.py @@ -42,7 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", - "hasGeometry": object_type.has_geometry, + "canHaveGeometry": object_type.can_have_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ], @@ -88,7 +88,7 @@ def test_create_objecttype(self): "providerOrganization": "tree provider", "documentationUrl": "http://example.com/doc/trees", "labels": {"key1": "value1"}, - "hasGeometry": False, + "canHaveGeometry": False, } response = self.client.post(url, data) @@ -115,7 +115,7 @@ def test_create_objecttype(self): self.assertEqual(object_type.labels, {"key1": "value1"}) self.assertEqual(object_type.created_at, date(2020, 1, 1)) self.assertEqual(object_type.modified_at, date(2020, 1, 1)) - self.assertEqual(object_type.has_geometry, False) + self.assertEqual(object_type.can_have_geometry, False) def test_update_objecttype(self): object_type = ObjectTypeFactory.create( diff --git a/src/objecttypes/tests/v2/test_objecttype_api.py b/src/objecttypes/tests/v2/test_objecttype_api.py index 6b190045..3829d020 100644 --- a/src/objecttypes/tests/v2/test_objecttype_api.py +++ b/src/objecttypes/tests/v2/test_objecttype_api.py @@ -42,7 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", - "hasGeometry": object_type.has_geometry, + "canHaveGeometry": object_type.can_have_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ], From 5b0205988e1c15527304f52ba7b2c65d28df75d4 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Fri, 3 Dec 2021 16:17:28 +0100 Subject: [PATCH 6/6] :ok_hand: rename 'canHaveGeometry' to 'allowGeometry' --- src/objecttypes/api/serializers.py | 4 ++-- src/objecttypes/api/v1/openapi.yaml | 8 ++++---- src/objecttypes/api/v2/openapi.yaml | 8 ++++---- src/objecttypes/core/admin.py | 2 +- .../core/migrations/0017_auto_20211203_1225.py | 4 ++-- src/objecttypes/core/models.py | 4 ++-- src/objecttypes/tests/v1/test_objecttype_api.py | 6 +++--- src/objecttypes/tests/v2/test_objecttype_api.py | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/objecttypes/api/serializers.py b/src/objecttypes/api/serializers.py index 832c87d4..3b2285af 100644 --- a/src/objecttypes/api/serializers.py +++ b/src/objecttypes/api/serializers.py @@ -95,7 +95,7 @@ class Meta: "labels", "createdAt", "modifiedAt", - "canHaveGeometry", + "allowGeometry", "versions", ) extra_kwargs = { @@ -110,7 +110,7 @@ class Meta: "updateFrequency": {"source": "update_frequency"}, "providerOrganization": {"source": "provider_organization"}, "documentationUrl": {"source": "documentation_url"}, - "canHaveGeometry": {"source": "can_have_geometry"}, + "allowGeometry": {"source": "allow_geometry"}, "createdAt": {"source": "created_at", "read_only": True}, "modifiedAt": {"source": "modified_at", "read_only": True}, } diff --git a/src/objecttypes/api/v1/openapi.yaml b/src/objecttypes/api/v1/openapi.yaml index 55577ebd..4c67d62f 100644 --- a/src/objecttypes/api/v1/openapi.yaml +++ b/src/objecttypes/api/v1/openapi.yaml @@ -495,9 +495,9 @@ components: format: date readOnly: true description: Last date when the object type was modified - hasGeometry: + allowGeometry: type: boolean - description: 'Shows whether the related objects have geographic coordinates. + description: 'Shows whether the related objects can have geographic coordinates. If the value is ''false'' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ' @@ -640,9 +640,9 @@ components: format: date readOnly: true description: Last date when the object type was modified - hasGeometry: + allowGeometry: type: boolean - description: 'Shows whether the related objects have geographic coordinates. + description: 'Shows whether the related objects can have geographic coordinates. If the value is ''false'' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ' diff --git a/src/objecttypes/api/v2/openapi.yaml b/src/objecttypes/api/v2/openapi.yaml index 425429ca..4bb7e854 100644 --- a/src/objecttypes/api/v2/openapi.yaml +++ b/src/objecttypes/api/v2/openapi.yaml @@ -515,9 +515,9 @@ components: format: date readOnly: true description: Last date when the object type was modified - hasGeometry: + allowGeometry: type: boolean - description: 'Shows whether the related objects have geographic coordinates. + description: 'Shows whether the related objects can have geographic coordinates. If the value is ''false'' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ' @@ -700,9 +700,9 @@ components: format: date readOnly: true description: Last date when the object type was modified - hasGeometry: + allowGeometry: type: boolean - description: 'Shows whether the related objects have geographic coordinates. + description: 'Shows whether the related objects can have geographic coordinates. If the value is ''false'' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ' diff --git a/src/objecttypes/core/admin.py b/src/objecttypes/core/admin.py index a71bad4b..f48a83a1 100644 --- a/src/objecttypes/core/admin.py +++ b/src/objecttypes/core/admin.py @@ -87,7 +87,7 @@ class Media: @admin.register(ObjectType) class ObjectTypeAdmin(admin.ModelAdmin): - list_display = ("name", "name_plural", "can_have_geometry") + list_display = ("name", "name_plural", "allow_geometry") search_fields = ("uuid",) inlines = [ObjectVersionInline] diff --git a/src/objecttypes/core/migrations/0017_auto_20211203_1225.py b/src/objecttypes/core/migrations/0017_auto_20211203_1225.py index ddd42b95..50507ee2 100644 --- a/src/objecttypes/core/migrations/0017_auto_20211203_1225.py +++ b/src/objecttypes/core/migrations/0017_auto_20211203_1225.py @@ -16,11 +16,11 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name="objecttype", - name="can_have_geometry", + name="allow_geometry", field=models.BooleanField( default=True, help_text="Shows whether the related objects can have geographic coordinates. If the value is 'false' the related objects are not allowed to have coordinates and the creation/update of objects with `geometry` property will raise an error ", - verbose_name="can have geometry", + verbose_name="allow geometry", ), ), ] diff --git a/src/objecttypes/core/models.py b/src/objecttypes/core/models.py index 991b66b2..5849e252 100644 --- a/src/objecttypes/core/models.py +++ b/src/objecttypes/core/models.py @@ -106,8 +106,8 @@ class ObjectType(models.Model): auto_now=True, help_text=_("Last date when the object type was modified"), ) - can_have_geometry = models.BooleanField( - _("can have geometry"), + allow_geometry = models.BooleanField( + _("allow geometry"), default=True, help_text=_( "Shows whether the related objects can have geographic coordinates. " diff --git a/src/objecttypes/tests/v1/test_objecttype_api.py b/src/objecttypes/tests/v1/test_objecttype_api.py index 863da257..de47842a 100644 --- a/src/objecttypes/tests/v1/test_objecttype_api.py +++ b/src/objecttypes/tests/v1/test_objecttype_api.py @@ -42,7 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", - "canHaveGeometry": object_type.can_have_geometry, + "allowGeometry": object_type.allow_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ], @@ -88,7 +88,7 @@ def test_create_objecttype(self): "providerOrganization": "tree provider", "documentationUrl": "http://example.com/doc/trees", "labels": {"key1": "value1"}, - "canHaveGeometry": False, + "allowGeometry": False, } response = self.client.post(url, data) @@ -115,7 +115,7 @@ def test_create_objecttype(self): self.assertEqual(object_type.labels, {"key1": "value1"}) self.assertEqual(object_type.created_at, date(2020, 1, 1)) self.assertEqual(object_type.modified_at, date(2020, 1, 1)) - self.assertEqual(object_type.can_have_geometry, False) + self.assertEqual(object_type.allow_geometry, False) def test_update_objecttype(self): object_type = ObjectTypeFactory.create( diff --git a/src/objecttypes/tests/v2/test_objecttype_api.py b/src/objecttypes/tests/v2/test_objecttype_api.py index 3829d020..0e1761a5 100644 --- a/src/objecttypes/tests/v2/test_objecttype_api.py +++ b/src/objecttypes/tests/v2/test_objecttype_api.py @@ -42,7 +42,7 @@ def test_get_objecttypes(self): "labels": object_type.labels, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", - "canHaveGeometry": object_type.can_have_geometry, + "allowGeometry": object_type.allow_geometry, "versions": [ f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" ],