1👍
Why not do something like this
self.helper.layout = Layout(
Div(
Field('message'), css_class="class-here"
),
# Field('description'), # or this way if you don't want to wrap around div
)
0👍
I don’t have much experience with crispy-forms, so this can be wrong, but try the following:
For the first issue try self.helper = FormHelper(self)
instead of self.helper = FormHelper()
To set the css class of a particular element, you would need to create a Layout
like:
self.helper.layout = Layout( Field('password', id="password-field", css_class="passwordfields", title="Explanation") )
👤NS0
- Django: How to assign a template variable to a views variable?
- How do I create a many to many relationship with an existing record?
Source:stackexchange.com