LocationGroup: always select_related('category')
This commit is contained in:
parent
8edb845deb
commit
268fb2f683
1 changed files with 7 additions and 0 deletions
|
@ -171,11 +171,18 @@ class LocationGroupCategory(TitledMixin, models.Model):
|
|||
return result
|
||||
|
||||
|
||||
class LocationGroupManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().select_related('category')
|
||||
|
||||
|
||||
class LocationGroup(Location, models.Model):
|
||||
category = models.ForeignKey(LocationGroupCategory, related_name='groups', on_delete=models.PROTECT,
|
||||
verbose_name=_('Category'))
|
||||
priority = models.IntegerField(default=0, db_index=True)
|
||||
|
||||
objects = LocationGroupManager()
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Location Group')
|
||||
verbose_name_plural = _('Location Groups')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue