From c66586fcdcf0501be078f2f7448a8452fe61cbdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Fri, 27 Dec 2019 18:42:08 +0100 Subject: [PATCH] dynamic locations in editor --- src/c3nav/editor/forms.py | 8 +++++--- src/c3nav/editor/urls.py | 1 + src/c3nav/editor/views/edit.py | 1 + src/c3nav/locale/de/LC_MESSAGES/django.po | 4 ++-- ...iongroupcategory_allow_dynamic_locations.py | 18 ++++++++++++++++++ src/c3nav/mapdata/models/locations.py | 1 + 6 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/c3nav/mapdata/migrations/0085_locationgroupcategory_allow_dynamic_locations.py diff --git a/src/c3nav/editor/forms.py b/src/c3nav/editor/forms.py index 1141d0bd..bbbc97c3 100644 --- a/src/c3nav/editor/forms.py +++ b/src/c3nav/editor/forms.py @@ -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] diff --git a/src/c3nav/editor/urls.py b/src/c3nav/editor/urls.py index 4549fea9..79d28335 100644 --- a/src/c3nav/editor/urls.py +++ b/src/c3nav/editor/urls.py @@ -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')) diff --git a/src/c3nav/editor/views/edit.py b/src/c3nav/editor/views/edit.py index 2bf09998..7330f605 100644 --- a/src/c3nav/editor/views/edit.py +++ b/src/c3nav/editor/views/edit.py @@ -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'), diff --git a/src/c3nav/locale/de/LC_MESSAGES/django.po b/src/c3nav/locale/de/LC_MESSAGES/django.po index ca44e021..90436e7f 100644 --- a/src/c3nav/locale/de/LC_MESSAGES/django.po +++ b/src/c3nav/locale/de/LC_MESSAGES/django.po @@ -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" diff --git a/src/c3nav/mapdata/migrations/0085_locationgroupcategory_allow_dynamic_locations.py b/src/c3nav/mapdata/migrations/0085_locationgroupcategory_allow_dynamic_locations.py new file mode 100644 index 00000000..e2206a28 --- /dev/null +++ b/src/c3nav/mapdata/migrations/0085_locationgroupcategory_allow_dynamic_locations.py @@ -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'), + ), + ] diff --git a/src/c3nav/mapdata/models/locations.py b/src/c3nav/mapdata/models/locations.py index 1e8e7abb..438640e0 100644 --- a/src/c3nav/mapdata/models/locations.py +++ b/src/c3nav/mapdata/models/locations.py @@ -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):