chore: ruff format

This commit is contained in:
Alexis Métaireau 2024-02-22 15:35:18 +01:00
parent f869d77f2c
commit 99d7b8a6e1
4 changed files with 20 additions and 8 deletions

View file

@ -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", "")
]

View file

@ -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"))

View file

@ -165,7 +165,8 @@ if settings.DEFAULT_FROM_EMAIL:
)
)
datalayer_urls = [
path("map/<int:map_id>/datalayer/update/<uuid:pk>/",
path(
"map/<int:map_id>/datalayer/update/<uuid:pk>/",
views.DataLayerUpdate.as_view(),
name="datalayer_update",
),

View file

@ -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