Reputation: 206
I have a three simple models:
class Tag(models.Model):
name = models.CharField(max_length=200)
class Task(models.Model):
name = models.CharField(max_length=200)
tag = models.ManyToManyField(Tag)
class Session(models.Model):
task = models.ForeignKey(Task)
It is hard to uers to select Task from all tasks in database. I want to allow user to reduce number of choices by filterting task by tag. So, user can select tag and then find task (in reduced amount of tasks). It is possible to implement?
Upvotes: 2
Views: 938
Reputation: 583
You can use list_filter
in your admin class:
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
list_filter = ('tag',)
Upvotes: 2