fix icons
This commit is contained in:
parent
2d8f37963b
commit
26bee6d94c
1 changed files with 7 additions and 6 deletions
|
@ -95,7 +95,7 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model):
|
||||||
def _serialize(self, **kwargs):
|
def _serialize(self, **kwargs):
|
||||||
result = super()._serialize(**kwargs)
|
result = super()._serialize(**kwargs)
|
||||||
result['subtitle'] = str(self.subtitle)
|
result['subtitle'] = str(self.subtitle)
|
||||||
result['icon'] = self.icon
|
result['icon'] = self.get_icon()
|
||||||
result['can_search'] = self.can_search
|
result['can_search'] = self.can_search
|
||||||
result['can_describe'] = self.can_search
|
result['can_describe'] = self.can_search
|
||||||
return result
|
return result
|
||||||
|
@ -203,11 +203,12 @@ class SpecificLocation(Location, models.Model):
|
||||||
|
|
||||||
def get_icon(self):
|
def get_icon(self):
|
||||||
icon = super().get_icon()
|
icon = super().get_icon()
|
||||||
if not icon:
|
if icon:
|
||||||
for group in self.groups.all():
|
return icon
|
||||||
if group.icon and getattr(group.category, 'allow_' + self.__class__._meta.default_related_name):
|
for group in self.groups.all():
|
||||||
return group.icon
|
if group.icon and getattr(group.category, 'allow_' + self.__class__._meta.default_related_name):
|
||||||
return icon
|
return group.icon
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class LocationGroupCategory(SerializableMixin, models.Model):
|
class LocationGroupCategory(SerializableMixin, models.Model):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue