feat: remove Map.description
The field was not populated since years, and we already have the info inside the JSONB `settings`.
This commit is contained in:
parent
52ab531362
commit
453056cb15
2 changed files with 23 additions and 1 deletions
16
umap/migrations/0021_remove_map_description.py
Normal file
16
umap/migrations/0021_remove_map_description.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-24 07:50
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("umap", "0020_alter_tilelayer_url_template"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="map",
|
||||
name="description",
|
||||
),
|
||||
]
|
|
@ -155,7 +155,6 @@ class Map(NamedModel):
|
|||
(BLOCKED, _("Blocked")),
|
||||
)
|
||||
slug = models.SlugField(db_index=True)
|
||||
description = models.TextField(blank=True, null=True, verbose_name=_("description"))
|
||||
center = models.PointField(geography=True, verbose_name=_("center"))
|
||||
zoom = models.IntegerField(default=7, verbose_name=_("zoom"))
|
||||
locate = models.BooleanField(
|
||||
|
@ -198,6 +197,13 @@ class Map(NamedModel):
|
|||
objects = models.Manager()
|
||||
public = PublicManager()
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
try:
|
||||
return self.settings["properties"]["description"]
|
||||
except KeyError:
|
||||
return ""
|
||||
|
||||
@property
|
||||
def preview_settings(self):
|
||||
layers = self.datalayer_set.all()
|
||||
|
|
Loading…
Reference in a new issue