Answer the question
In order to leave comments, you need to log in
How to make a global filter in Django admin?
Is it possible to make a global filter in the admin panel?
For example, there are models:
class Company(models.Model):
name = models.CharField(
'Название компании',
max_length=200,
help_text='Название компании'
)
city = models.CharField(
'Город',
max_length=200,
help_text='Город'
)
class Object(models.Model):
name = models.CharField(
'Название объекта',
max_length=200,
help_text='Название объекта'
)
number = models.CharField(
'Номер объекта',
max_length=200,
help_text='Номер объекта'
)
company = models.ForeignKey(
Company,
on_delete=models.SET_NULL,
verbose_name='Компания',
null=True
)
class Person(models.Model):
name = models.CharField(
'Имя,
max_length=200,
help_text='Имя'
)
number = models.CharField(
'ID персоны',
max_length=200,
help_text='ID персоны'
)
object = models.ForeignKey(
Object,
on_delete=models.SET_NULL,
verbose_name='Объект',
null=True
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question