D
D
Daria Belova2019-04-21 11:37:54
Django
Daria Belova, 2019-04-21 11:37:54

How to display inline filter in Django admin?

Hello, I have been working with django for quite some time now and I am interested in the following question.
Is it possible to display in list_filter by added inline?
Need to filter by executer_id

model.py

class Order(models.Model):
    users_create = models.ForeignKey(User,  on_delete=models.CASCADE)
    date_create = models.DateTimeField()
    date_work = models.DateField()
    date_close = models.DateField()

class OrderExecuter(models.Model):
    order_id = models.ForeignKey(Order, on_delete=models.CASCADE)
    executer_id = models.ManyToManyField(User)


class OrderExecuterInline(admin.TabularInline):
    model = OrderExecuter
    extra = 1
    max_num = 1

@admin.register(Order)
class Order(admin.ModelAdmin):
    inlines = (OrderExecuterInline, )
    list_filter = (?????)

To make it so
5cbc2b899ada0284600102.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question