Open krystofbe opened 2 years ago
Thanks for the nice words! I think @nerdoc mentioned some investigation with crispy forms and Unicorn in https://github.com/adamghill/django-unicorn/discussions/227 which might be helpful? However, if you could make a PR with some sample code using crispy forms I could see if I could add anything to unicorn to help in future releases.
Bad Hack(TM): patch Unicorn, to let UnicornView inherit from FormView instead of TemplateView.
class MyForm(Form)
email = forms.EmailField()
# Unicorn Component
class EmailView(UnicornView):
form = MyForm
And in the template:
{% load unicorn crispy_forms_tags %}
<div>
{% crispy form %}
</div>
I just wrote this here in a few minutes, so it's not tested and copy'n'pasted, but it should work,
Whether it is a good idea to "patch" Unicorn and urge it to be a FormView - I don't know - that has to decide @adamghill - there is another discussion for that...
Cheers
just found out about this awesome library. thanks a lot. love it! <3
while playing around with the unicorn, I noticed that i can't use the form validation with
form_class
when using form helpers or crispy forms and get some error like thisthis is probably related to https://github.com/adamghill/django-unicorn/issues/324.
has anybody found a way to make the unicorn validation functionality work together with crispy forms or form helpers in general?