I want to implement a Basic Search function to my Django Project
I have a dropdown field with all model Fields of my userdb
model.
forms.py
class searchForm(forms.Modelform):
field=forms.ModelChoiceField(queryset=[f.name for f in MyModel._meta.get_fields()],widget=forms.Select(attrs={'class':'form-select','data-live-search':'true'}))
class Meta:
model=userdb
fields='__all__'
input=forms.CharField()
How can I validate if the input of the input
charfield is correctly Formated depending on the selected field in field
.