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"]) row.save(update_fields=["uuid"])
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("umap", "0017_migrate_to_openstreetmap_oauth2"), ("umap", "0017_migrate_to_openstreetmap_oauth2"),
@ -25,13 +24,19 @@ class Migration(migrations.Migration):
field=models.UUIDField(default=uuid.uuid4, editable=False, null=True), field=models.UUIDField(default=uuid.uuid4, editable=False, null=True),
), ),
migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop), 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.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( migrations.AlterField(
model_name="datalayer", model_name="datalayer",
name="uuid", 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", "") # migrations.RemoveConstraint("datalayer", "")
] ]

View file

@ -374,7 +374,9 @@ class DataLayer(NamedModel):
(EDITORS, _("Editors only")), (EDITORS, _("Editors only")),
(OWNER, _("Owner 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) id = models.IntegerField(null=True, blank=True)
map = models.ForeignKey(Map, on_delete=models.CASCADE) map = models.ForeignKey(Map, on_delete=models.CASCADE)
description = models.TextField(blank=True, null=True, verbose_name=_("description")) description = models.TextField(blank=True, null=True, verbose_name=_("description"))

View file

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

View file

@ -441,7 +441,9 @@ ajax_proxy = AjaxProxy.as_view()
def simple_json_response(**kwargs): 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"] = {}
geojson["properties"].update(properties) geojson["properties"].update(properties)
geojson["properties"]["datalayers"] = self.get_datalayers() 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) self.set_preconnect(geojson["properties"], context)
return context return context