Hello,
I am trying to find out if it is possible to have a list_filter in admin.TabularInline.
I have tried to use it but it does not display any filter. But also I am not getting any error.
Can anyone address me to examples/documentation?
Something like the following:
models.py
from django.db import models
class Foo(models.Model):
title = models.CharField(max_length=128)
class Meta:
verbose_name = "Foo"
verbose_name_plural = "Foo"
def __str__(self):
pass
class Bar(models.Model):
title = models.CharField(max_length=128)
foo = models.ForeignKey(Foo)
class Meta:
verbose_name = "Bar"
verbose_name_plural = "Bars"
def __str__(self):
return self.title
admin.py
from django.contrib import admin
from django import forms
from . import models
class BarInline(admin.TabularInline):
model = models.Bar
form = BarInlineForm
list_filter = ['title']
extra = 3
class FooAdmin(admin.ModelAdmin):
inlines = [BarInline]
admin.site.register(models.Foo, FooAdmin)