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

Exception while resolving variable 'required_css_class' in template 'bootstrapform/form.html'. #92

Open
montaro opened this issue Nov 7, 2016 · 3 comments

Comments

@montaro
Copy link

montaro commented Nov 7, 2016

I always see this error in logs, I use:

django-bootstrap-form==3.2.1 
pinax-theme-bootstrap==7.11.0
@rowanv
Copy link

rowanv commented Feb 6, 2017

Am experiencing this as well, also using django-bootstrap-form==3.2.1, with Django==1.10.5.

@drivard
Copy link

drivard commented Jun 2, 2017

Hi, I was getting the same issue in my project using Python 3.4.3 and I figured out that the issue is in the field.html template at line 50. I had to add the check on form.required_css_class into the if statement like the following <label class="control-label {{ classes.label }} {% if field.field.required and form.required_css_class %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>.

I just can't explain the reason for it.
The second problem is that this works without my change when running through python manage.py runserver in local dev environment, but once I deploy my code and that I run it through nginx and uwsgi it throws the same error as described here.

Any idea on why it just doesn't show or output the empty variable like it does in local dev?

@drivard
Copy link

drivard commented Jun 2, 2017

More information about this issue, from the documentation here: https://docs.djangoproject.com/en/1.11/ref/forms/api/#styling-required-or-erroneous-form-rows to fix this issue without modifying django-bootstrap-form we had to add the following line to our form. required_css_class = 'required'. Hope it can help you fix your issue.

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

No branches or pull requests

3 participants