Open Vayel opened 4 years ago
Defining the related_name
seems to fix the error:
class Publication(models.Model):
title = models.CharField(max_length=30)
class Article(models.Model):
headline = models.CharField(max_length=100)
publications = models.ManyToManyField(Publication, related_name="articles")
# Filter publications by articles they belong to
class ArticleFilter(AutocompleteFilter):
title = "Article"
field_name = "articles" # Use the related name here
class PublicationAdmin(admin.ModelAdmin):
model = Publication
list_filter = (ArticleFilter,)
I think this should all be fixed by the changes in pre_release
now.
Hi!
Thanks for this great package! Here is an enhancement proposal: being able to filter by a reverse many-to-many relation. For instance:
Thanks!