add Location.details_display()
This commit is contained in:
parent
ba3e1e485e
commit
949b88389e
8 changed files with 114 additions and 78 deletions
|
@ -1,4 +1,5 @@
|
|||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -52,6 +53,11 @@ class SpaceGeometryMixin(GeometryMixin):
|
|||
self.geometry if force else self.get_changed_geometry()
|
||||
))
|
||||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['display'].insert(3, (str(_('Space')), {'slug': self.space.get_slug(), 'title': self.space.title}))
|
||||
return result
|
||||
|
||||
def register_delete(self):
|
||||
space = self.space
|
||||
changed_geometries.register(space.level_id, space.geometry.intersection(self.geometry))
|
||||
|
@ -88,6 +94,11 @@ class Area(SpaceGeometryMixin, SpecificLocation, models.Model):
|
|||
result = super()._serialize(**kwargs)
|
||||
return result
|
||||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['editor_url'] = reverse('editor.areas.edit', kwargs={'space': self.space_id, 'pk': self.pk})
|
||||
return result
|
||||
|
||||
|
||||
class Stair(SpaceGeometryMixin, models.Model):
|
||||
"""
|
||||
|
@ -168,6 +179,11 @@ class POI(SpaceGeometryMixin, SpecificLocation, models.Model):
|
|||
verbose_name_plural = _('Points of Interest')
|
||||
default_related_name = 'pois'
|
||||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['editor_url'] = reverse('editor.pois.edit', kwargs={'space': self.space_id, 'pk': self.pk})
|
||||
return result
|
||||
|
||||
|
||||
class Hole(SpaceGeometryMixin, models.Model):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue