introduce intermediate level setting

This commit is contained in:
Laura Klünder 2024-12-19 00:05:37 +01:00
parent a4a7f02d0b
commit 9446c34e8a
8 changed files with 39 additions and 15 deletions

View file

@ -72,11 +72,16 @@ class LevelsForLevel:
# noinspection PyPep8Naming
levels_under = ()
levels_on_top = ()
lower_level = level.lower(Level).first()
primary_levels = (level,) + ((lower_level,) if lower_level else ())
lower_levels = []
for sublevel in level.lower(Level):
lower_levels.append(sublevel)
if not sublevel.intermediate:
break
primary_levels = chain((level,), lower_levels)
secondary_levels = Level.objects.filter(on_top_of__in=primary_levels).values_list('pk', 'on_top_of')
if lower_level:
levels_under = tuple(pk for pk, on_top_of in secondary_levels if on_top_of == lower_level.pk)
lower_level_pks = set(l.pk for l in lower_levels)
if lower_levels:
levels_under = tuple(pk for pk, on_top_of in secondary_levels if on_top_of in lower_level_pks)
if True:
levels_on_top = tuple(pk for pk, on_top_of in secondary_levels if on_top_of == level.pk)

View file

@ -401,7 +401,8 @@ def create_editor_form(editor_model):
'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',
'base_altitude', 'intermediate',
'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', 'node_number', 'wifi_bssid', 'bluetooth_address', "group",
'ibeacon_uuid', 'ibeacon_major', 'ibeacon_minor', 'uwb_address', 'extra_seconds', 'speed', 'can_report_missing',