Answer the question
In order to leave comments, you need to log in
Django-Filters: in select, email is passed instead of the user field. How to fix?
Good night or morning. Someone has something. We have the following models:
class City(models.Model):
name = models.CharField()
class User(models.Model):
city = models.ForeignKey(City)
city = filters.ModelChoiceFilter(
queryset=User.objects.all(),
field_name='city',
to_field_name='city',
label=_('Filter by city:'),
)
class Meta:
model = User
fields = {
'city__name': ['exact',]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question