Skip to content
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

In ModelChoiceField 'selected'-Tag is missing, when ModelForm is invalid #98

Closed
datenrebell opened this issue Apr 23, 2021 · 1 comment · Fixed by #150
Closed

In ModelChoiceField 'selected'-Tag is missing, when ModelForm is invalid #98

datenrebell opened this issue Apr 23, 2021 · 1 comment · Fixed by #150

Comments

@datenrebell
Copy link

datenrebell commented Apr 23, 2021

Hello,

I have a model with at least two ForeignKey-ModelFields. Both fields are blank = False. I Use a Modelform and Crispy-Tailwind. If the Foreign-Fields in an object are assigned except one and you commit the form, the form will be invalid. The problem is, that in the next rendering of all ForeignFields the "selected"-HTML-tag are missing and so all Foreign-Fields are unselected. The problem does not occur without Crispy-Tailwind.

You can see the problem in my repository: https://github.com/datenrebell/bug_in_crispy_tailwind

I hope you can help me with this Issue.
Thanks.

@tissieres
Copy link

I have the same problem. It is related to #90 since the default django django/forms/widgets/select.html template is badly overriden by this package. I fixed this by applying the @tailwindcss/forms plugin and overriding the field.html template of this application to remove the inclusion of the custom select.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants