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

Add crispy forms example #372

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add crispy forms example #372

wants to merge 3 commits into from

Conversation

adamghill
Copy link
Owner

An example with crispy forms for #368 and #362.

@adamghill adamghill self-assigned this Mar 5, 2022
{% extends "www/base.html" %}
{% load crispy_forms_tags unicorn %}

{% load crispy_forms_tags %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unnecessarily loaded twice

<div unicorn:view>
<h2>Crispy</h2>

{% crispy view.form_class view.form_class.helper %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the view.form_class.helper can be omitted (if FormHelper attr is called helper, as you did)

super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = "id-exampleForm"
self.helper.form_class = "blueForms"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this line from the unicorn crispy example as well - this is just a CSS that is added, from the crispy example.

Copy link
Contributor

@nerdoc nerdoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may work for a DirectView. But if you build a "normal" component which you include using {% unicorn ... %}, it doesn't find the form_classvariable in the context... This is a major showstopper...

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 this pull request may close these issues.

2 participants