From 99d7b8a6e108f8f05996fce011ee4335ed074e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Thu, 22 Feb 2024 15:35:18 +0100 Subject: [PATCH] chore: ruff format --- umap/migrations/0018_datalayer_uuid.py | 13 +++++++++---- umap/models.py | 4 +++- umap/urls.py | 3 ++- umap/views.py | 8 ++++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/umap/migrations/0018_datalayer_uuid.py b/umap/migrations/0018_datalayer_uuid.py index 6153b1e9..e0a655c9 100644 --- a/umap/migrations/0018_datalayer_uuid.py +++ b/umap/migrations/0018_datalayer_uuid.py @@ -12,7 +12,6 @@ def gen_uuid(apps, schema_editor): row.save(update_fields=["uuid"]) - class Migration(migrations.Migration): dependencies = [ ("umap", "0017_migrate_to_openstreetmap_oauth2"), @@ -25,13 +24,19 @@ class Migration(migrations.Migration): field=models.UUIDField(default=uuid.uuid4, editable=False, null=True), ), migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop), - migrations.RunSQL("ALTER TABLE umap_datalayer DROP CONSTRAINT umap_datalayer_pkey"), + migrations.RunSQL( + "ALTER TABLE umap_datalayer DROP CONSTRAINT umap_datalayer_pkey" + ), # migrations.RemoveConstraint("datalayer", "id"), - migrations.AlterField("datalayer", name="id", field=models.IntegerField(null=True, blank=True)), + migrations.AlterField( + "datalayer", name="id", field=models.IntegerField(null=True, blank=True) + ), migrations.AlterField( model_name="datalayer", name="uuid", - field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True), + field=models.UUIDField( + default=uuid.uuid4, editable=False, unique=True, primary_key=True + ), ), # migrations.RemoveConstraint("datalayer", "") ] diff --git a/umap/models.py b/umap/models.py index 0a2fce84..8257c8cb 100644 --- a/umap/models.py +++ b/umap/models.py @@ -374,7 +374,9 @@ class DataLayer(NamedModel): (EDITORS, _("Editors only")), (OWNER, _("Owner only")), ) - uuid = models.UUIDField(unique=True, primary_key=True, default=uuid.uuid4, editable=False) + uuid = models.UUIDField( + unique=True, primary_key=True, default=uuid.uuid4, editable=False + ) id = models.IntegerField(null=True, blank=True) map = models.ForeignKey(Map, on_delete=models.CASCADE) description = models.TextField(blank=True, null=True, verbose_name=_("description")) diff --git a/umap/urls.py b/umap/urls.py index 6467e733..28564b55 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -165,7 +165,8 @@ if settings.DEFAULT_FROM_EMAIL: ) ) datalayer_urls = [ - path("map//datalayer/update//", + path( + "map//datalayer/update//", views.DataLayerUpdate.as_view(), name="datalayer_update", ), diff --git a/umap/views.py b/umap/views.py index 3fd8c76d..b43605c6 100644 --- a/umap/views.py +++ b/umap/views.py @@ -441,7 +441,9 @@ ajax_proxy = AjaxProxy.as_view() def simple_json_response(**kwargs): - return HttpResponse(json.dumps(kwargs, cls=DjangoJSONEncoder), content_type="application/json") + return HttpResponse( + json.dumps(kwargs, cls=DjangoJSONEncoder), content_type="application/json" + ) # ############## # @@ -537,7 +539,9 @@ class MapDetailMixin: geojson["properties"] = {} geojson["properties"].update(properties) geojson["properties"]["datalayers"] = self.get_datalayers() - context["map_settings"] = json.dumps(geojson, indent=settings.DEBUG, cls=DjangoJSONEncoder) + context["map_settings"] = json.dumps( + geojson, indent=settings.DEBUG, cls=DjangoJSONEncoder + ) self.set_preconnect(geojson["properties"], context) return context