new serializer for hole, area, stair, and ramp
This commit is contained in:
parent
ed00cbd0e5
commit
38b4fbe1f0
1 changed files with 8 additions and 5 deletions
|
@ -126,6 +126,8 @@ class Area(SpaceGeometryMixin, SpecificLocation, models.Model):
|
|||
"""
|
||||
An area in a space.
|
||||
"""
|
||||
new_serialize = True
|
||||
|
||||
geometry = GeometryField('polygon')
|
||||
slow_down_factor = models.DecimalField(_('slow down factor'), max_digits=6, decimal_places=2, default=1,
|
||||
validators=[MinValueValidator(Decimal('0.01'))],
|
||||
|
@ -138,11 +140,6 @@ class Area(SpaceGeometryMixin, SpecificLocation, models.Model):
|
|||
verbose_name_plural = _('Areas')
|
||||
default_related_name = 'areas'
|
||||
|
||||
def _serialize(self, **kwargs):
|
||||
result = super()._serialize(**kwargs)
|
||||
result["slow_down_factor"] = float(self.slow_down_factor)
|
||||
return result
|
||||
|
||||
@property
|
||||
def grid_square(self):
|
||||
if "geometry" in self.get_deferred_fields():
|
||||
|
@ -160,6 +157,8 @@ class Stair(SpaceGeometryMixin, models.Model):
|
|||
"""
|
||||
A stair
|
||||
"""
|
||||
new_serialize = True
|
||||
|
||||
geometry = GeometryField('linestring')
|
||||
|
||||
class Meta:
|
||||
|
@ -172,6 +171,8 @@ class Ramp(SpaceGeometryMixin, models.Model):
|
|||
"""
|
||||
A ramp
|
||||
"""
|
||||
new_serialize = True
|
||||
|
||||
geometry = GeometryField('polygon')
|
||||
|
||||
class Meta:
|
||||
|
@ -342,6 +343,8 @@ class Hole(SpaceGeometryMixin, models.Model):
|
|||
"""
|
||||
A hole in the ground of a space, e.g. for stairs.
|
||||
"""
|
||||
new_serialize = True
|
||||
|
||||
geometry = GeometryField('polygon')
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue