add Location.details_display()
This commit is contained in:
parent
ba3e1e485e
commit
949b88389e
8 changed files with 114 additions and 78 deletions
|
@ -4,6 +4,7 @@ from operator import attrgetter, itemgetter
|
|||
import numpy as np
|
||||
from django.db import models
|
||||
from django.db.models import F
|
||||
from django.urls import reverse
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from scipy.sparse.csgraph._shortest_path import dijkstra
|
||||
|
@ -43,6 +44,11 @@ class LevelGeometryMixin(GeometryMixin):
|
|||
result['level'] = self.level_id
|
||||
return result
|
||||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['display'].insert(3, (str(_('Level')), {'slug': self.level.get_slug(), 'title': self.level.title}))
|
||||
return result
|
||||
|
||||
@property
|
||||
def subtitle(self):
|
||||
base_subtitle = super().subtitle
|
||||
|
@ -96,6 +102,15 @@ class Space(LevelGeometryMixin, SpecificLocation, models.Model):
|
|||
result['height'] = None if self.height is None else float(str(self.height))
|
||||
return result
|
||||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['display'].extend([
|
||||
(str(_('height')), self.height),
|
||||
(str(_('outside only')), str(_('yes') if self.outside else _('no'))),
|
||||
])
|
||||
result['editor_url'] = reverse('editor.spaces.detail', kwargs={'level': self.level_id, 'pk': self.pk})
|
||||
return result
|
||||
|
||||
|
||||
class Door(LevelGeometryMixin, AccessRestrictionMixin, models.Model):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue