D
D
Daniil Chernov2020-09-27 09:35:22
Django
Daniil Chernov, 2020-09-27 09:35:22

How to display two models in the django admin in one table?

There are two models.
Both are the same, the difference is only in the name.

spoiler
class ModelA(models.Model):
    sum = models.FloatField(verbose_name='Сумма')
    com = models.TextField(verbose_name='Коментарий', blank=True, null=True)


class ModelB(models.Model):
    sum = models.FloatField(verbose_name='Сумма')
    com = models.TextField(verbose_name='Коментарий', blank=True, null=True)


Both are registered in the admin panel.

How to combine them?
That is, that there would be all objects from both models in one table, as well as that it would be possible to use filters and search.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-09-27
@dancha

Inherit them from a common root and register it in the admin panel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question