use new serializer for spaces and doors
This commit is contained in:
parent
8be5f0f9fb
commit
ed00cbd0e5
1 changed files with 4 additions and 6 deletions
|
@ -120,6 +120,8 @@ class Space(LevelGeometryMixin, SpecificLocation, models.Model):
|
||||||
"""
|
"""
|
||||||
An accessible space. Shouldn't overlap with spaces on the same level.
|
An accessible space. Shouldn't overlap with spaces on the same level.
|
||||||
"""
|
"""
|
||||||
|
new_serialize = True
|
||||||
|
|
||||||
geometry = GeometryField('polygon')
|
geometry = GeometryField('polygon')
|
||||||
height = models.DecimalField(_('height'), max_digits=6, decimal_places=2, null=True, blank=True,
|
height = models.DecimalField(_('height'), max_digits=6, decimal_places=2, null=True, blank=True,
|
||||||
validators=[MinValueValidator(Decimal('0'))])
|
validators=[MinValueValidator(Decimal('0'))])
|
||||||
|
@ -133,12 +135,6 @@ class Space(LevelGeometryMixin, SpecificLocation, models.Model):
|
||||||
verbose_name_plural = _('Spaces')
|
verbose_name_plural = _('Spaces')
|
||||||
default_related_name = 'spaces'
|
default_related_name = 'spaces'
|
||||||
|
|
||||||
def _serialize(self, geometry=True, **kwargs):
|
|
||||||
result = super()._serialize(geometry=geometry, **kwargs)
|
|
||||||
result['outside'] = self.outside
|
|
||||||
result['height'] = None if self.height is None else float(str(self.height))
|
|
||||||
return result
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def grid_square(self):
|
def grid_square(self):
|
||||||
if "geometry" in self.get_deferred_fields():
|
if "geometry" in self.get_deferred_fields():
|
||||||
|
@ -160,6 +156,8 @@ class Door(LevelGeometryMixin, AccessRestrictionMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
A connection between two spaces
|
A connection between two spaces
|
||||||
"""
|
"""
|
||||||
|
new_serialize = True
|
||||||
|
|
||||||
geometry = GeometryField('polygon')
|
geometry = GeometryField('polygon')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue