add in_legend field for locationgroups
This commit is contained in:
parent
70c6ab0aa0
commit
839d4beb7c
3 changed files with 35 additions and 3 deletions
|
@ -417,9 +417,9 @@ class EditorFormBase(I18nModelFormMixin, ModelForm):
|
|||
|
||||
|
||||
def create_editor_form(editor_model):
|
||||
possible_fields = ['slug', 'name', 'title', 'title_plural', 'help_text', 'position_secret',
|
||||
'icon', 'join_edges', 'up_separate', 'bssid', 'main_point', 'external_url', 'hub_import_type',
|
||||
'walk', 'ordering', 'category', 'width', 'groups', 'height', 'color', 'priority', 'hierarchy',
|
||||
possible_fields = ['slug', 'name', 'title', 'title_plural', 'help_text', 'position_secret', 'icon', 'join_edges',
|
||||
'up_separate', 'bssid', 'main_point', 'external_url', 'hub_import_type', 'walk', 'ordering',
|
||||
'category', 'width', 'groups', 'height', 'color', 'in_legend', 'priority', 'hierarchy',
|
||||
'icon_name', 'base_altitude', 'waytype', 'access_restriction', 'default_height', 'door_height',
|
||||
'outside', 'can_search', 'can_describe', 'geometry', 'single', 'altitude', 'short_label',
|
||||
'origin_space', 'target_space', 'data', 'comment', 'slow_down_factor', 'groundaltitude',
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 5.0.8 on 2024-09-06 12:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def forwards_func(apps, schema_editor):
|
||||
LocationGroup = apps.get_model('mapdata', 'LocationGroup')
|
||||
for group in LocationGroup.objects.all():
|
||||
group.in_legend = bool(group.color and (group.can_describe or group.can_search))
|
||||
group.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mapdata', '0107_altitudearea_multiple_points'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='locationgroup',
|
||||
name='in_legend',
|
||||
field=models.BooleanField(default=False, verbose_name='show in legend (if color set)'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='beaconmeasurement',
|
||||
name='data',
|
||||
field=models.JSONField(default=dict, verbose_name='Measurement list'),
|
||||
),
|
||||
migrations.RunPython(forwards_func, migrations.RunPython.noop),
|
||||
]
|
|
@ -373,6 +373,7 @@ class LocationGroup(Location, models.Model):
|
|||
fallback_value="", help_text=_('to explain the report form or rejection'))
|
||||
|
||||
color = models.CharField(null=True, blank=True, max_length=32, verbose_name=_('background color'))
|
||||
in_legend = models.BooleanField(default=False, verbose_name=_('show in legend (if color set)'))
|
||||
hub_import_type = models.CharField(max_length=100, verbose_name=_('hub import type'), null=True, blank=True,
|
||||
unique=True,
|
||||
help_text=_('assign this group to imported hub locations of this type'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue