simpler describe_location

This commit is contained in:
Laura Klünder 2017-12-18 01:57:36 +01:00
parent 032dcebcd0
commit ee83d56a5c
2 changed files with 2 additions and 7 deletions

View file

@ -85,10 +85,7 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model):
def serialize(self, detailed=True, describe_only=False, **kwargs):
result = super().serialize(detailed=detailed, **kwargs)
if not detailed:
if describe_only and not self.can_describe:
fields = ('id', 'on_top_of')
else:
fields = ('id', 'type', 'slug', 'title', 'subtitle', 'point', 'bounds', 'locations', 'on_top_of')
fields = ('id', 'type', 'slug', 'title', 'subtitle', 'point', 'bounds', 'locations', 'on_top_of')
result = OrderedDict(((name, result[name]) for name in fields if name in result))
return result