get_color() only allow groups that are allowed for this model
This commit is contained in:
parent
268fb2f683
commit
2fa482d9fd
1 changed files with 1 additions and 1 deletions
|
@ -124,7 +124,7 @@ class Location(LocationSlug, TitledMixin, models.Model):
|
|||
if instance is None:
|
||||
instance = self
|
||||
for group in instance.groups.all():
|
||||
if group.color:
|
||||
if group.color and getattr(group.category, 'allow_'+self.__class__._meta.default_related_name):
|
||||
return group.color
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue