You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The form is successfully generated and a list of streets is generated. But when selecting and trying to filter, the form displays an error Select a valid choice. That choice is not one of the available choices. Model
class Address(models.Model):
city = models.ForeignKey(City, on_delete=models.PROTECT, verbose_name="Город")
street = models.CharField(max_length=255, verbose_name="Улица")
numb = models.CharField(max_length=64, verbose_name="Номер дома")
def __str__(self):
return self.street
Filter
class ProjectFilter(django_filters.FilterSet):
address = django_filters.ModelChoiceFilter(
queryset=Address.objects.values_list('street', flat=True),
widget= forms.Select(),
label="Addrees",
label_suffix="",
)
class Meta:
model = Project
exclude = [field.name for field in Project._meta.fields]
order_by_field = 'address'
URL result http://127.0.0.1:8000/table/?address=Forest
The text was updated successfully, but these errors were encountered:
The form is successfully generated and a list of streets is generated. But when selecting and trying to filter, the form displays an error Select a valid choice. That choice is not one of the available choices.
Model
Filter
URL result
http://127.0.0.1:8000/table/?address=Forest
The text was updated successfully, but these errors were encountered: