-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChoiceFilter not working as expected with | crispy #1498
Comments
Is the |
This might be django-crispy-forms/crispy-tailwind#119 🤔 |
I'm calling the following URL: http://localhost:8000/task/?status=30 With
With
I wanted to debug my template to figure out which values are passed to crispy, but I didn't manage. :-) The issue might be in these files: select.html and especially select_option.html. I've compared it to the crispy-bootstrap5 repository, but there seems to be nothing similar available. |
On the other hand I'm not sure if the issue is with crispy-tailwind, as there are other dropdown fields on other forms which work as expected. But these fields are on a plain form, not a filter. Thus I've raised the issue with django-filter and not crispy-tailwind. |
The form is right, since the |
I think I've fixed it.
With adding |stringformat:'s' to the value comparison it works for form fields and the django-filter fields. Would this solution be good enough for a pull request? |
I think yes. Do open it on crispy-tailwind. I will let @smithdc1 know there's incoming. 😃 |
Actually there are two other pull requests on the Select feature.. so my pull request could be obsolete: Especially the first one would make mine and the second one obsolete. Who will guide us out on the way forward and when are crispy-tailwind releases usually made public? :-) |
@gldecurtins On the last I'd likely suggest installing from GitHub as the crispy-tailwind package is still beta, and there may not be a release imminent. |
Here's a link for installing from GitHub: https://pip.pypa.io/en/stable/topics/vcs-support/ |
I'll close this as I don't think it's a Django-filter issue. |
Hi all
I'm trying to combine django-filter with crispy-tailwind. The expected behavior is that the ChoiceFilter adds the selected attribute so that the filtered value would be pre-selected. The records are filtered correctly.
This works fine with:
But doesn't work with:
With
| crispy
the ChoiceLists look beautiful, but the filtered value is not selected:Any thoughts?
Below you'll find a few lines of code. I think I've extracted the relevant pieces. Full code is available in my objector github repository.
models.py
filters.py
views.py
The text was updated successfully, but these errors were encountered: