dynamic locations in editor

This commit is contained in:
Laura Klünder 2019-12-27 18:42:08 +01:00
parent 92be350b8c
commit c66586fcdc
6 changed files with 28 additions and 5 deletions

View file

@ -277,15 +277,17 @@ class EditorFormBase(I18nModelFormMixin, ModelForm):
def create_editor_form(editor_model):
possible_fields = ['slug', 'name', 'title', 'title_plural', 'help_text', 'icon', 'join_edges', 'up_separate',
possible_fields = ['slug', 'name', 'title', 'title_plural', 'help_text', 'position_secret',
'icon', 'join_edges', 'up_separate',
'walk', 'ordering', 'category', 'width', 'groups', 'height', 'color', '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',
'origin_space', 'target_space', 'data', 'comment', 'slow_down_factor', ''
'extra_seconds', 'speed', 'description', 'speed_up', 'description_up', 'enter_description',
'level_change_description', 'base_mapdata_accessible', 'can_report_missing',
'label_settings', 'label_override', 'min_zoom', 'max_zoom', 'font_size',
'allow_levels', 'allow_spaces', 'allow_areas', 'allow_pois', 'left', 'top', 'right', 'bottom']
'allow_levels', 'allow_spaces', 'allow_areas', 'allow_pois', 'allow_dynamic_locations',
'left', 'top', 'right', 'bottom']
field_names = [field.name for field in editor_model._meta.get_fields() if not field.one_to_many]
existing_fields = [name for name in possible_fields if name in field_names]

View file

@ -53,6 +53,7 @@ urlpatterns = [
urlpatterns.extend(add_editor_urls('Level', with_list=False, explicit_edit=True))
urlpatterns.extend(add_editor_urls('LocationGroupCategory'))
urlpatterns.extend(add_editor_urls('LocationGroup'))
urlpatterns.extend(add_editor_urls('DynamicLocation'))
urlpatterns.extend(add_editor_urls('WayType'))
urlpatterns.extend(add_editor_urls('AccessRestriction'))
urlpatterns.extend(add_editor_urls('AccessRestrictionGroup'))

View file

@ -52,6 +52,7 @@ def main_index(request):
'child_models': [
child_model(request, 'LocationGroupCategory'),
child_model(request, 'LocationGroup'),
child_model(request, 'DynamicLocation'),
child_model(request, 'WayType'),
child_model(request, 'AccessRestriction'),
child_model(request, 'AccessRestrictionGroup'),

View file

@ -2327,11 +2327,11 @@ msgstr "position secret"
#: c3nav/mapdata/models/locations.py:465
msgid "Dynamic location"
msgstr "Dynamischer Ort."
msgstr "Dynamischer Ort"
#: c3nav/mapdata/models/locations.py:466
msgid "Dynamic locations"
msgstr "Dynamische Orte."
msgstr "Dynamische Orte"
#: c3nav/mapdata/models/locations.py:496
msgid "name"

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.8 on 2019-12-27 17:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0084_position_timeout'),
]
operations = [
migrations.AddField(
model_name='locationgroupcategory',
name='allow_dynamic_locations',
field=models.BooleanField(db_index=True, default=True, verbose_name='allow dynamic locations'),
),
]

View file

@ -272,6 +272,7 @@ class LocationGroupCategory(SerializableMixin, models.Model):
allow_spaces = models.BooleanField(_('allow spaces'), db_index=True, default=True)
allow_areas = models.BooleanField(_('allow areas'), db_index=True, default=True)
allow_pois = models.BooleanField(_('allow pois'), db_index=True, default=True)
allow_dynamic_locations = models.BooleanField(_('allow dynamic locations'), db_index=True, default=True)
priority = models.IntegerField(default=0, db_index=True)
def __init__(self, *args, **kwargs):