Comments (10)
It's pretty strange since your settings.CRISPY_TEMPLATE_PACK is correct. What version of crispy_forms are you using ?
I didnt look at it, maybe the 1.5.x is adding some restrictions.
from crispy-forms-foundation.
And by the way, can you paste me your full exception in a pastebin or alike ?
from crispy-forms-foundation.
TemplateSyntaxError at /login/
crispy tag's template_pack argument should be in ('bootstrap', 'uni_form', 'bootstrap3')
Request Method: GET
Request URL: http://localhost:8000/login/
Django Version: 1.8.3
Exception Type: TemplateSyntaxError
Exception Value:
crispy tag's template_pack argument should be in ('bootstrap', 'uni_form', 'bootstrap3')
Exception Location: /home/alex/py3/lib/python3.4/site-packages/crispy_forms/templatetags/crispy_forms_tags.py in do_uni_form, line 285
Python Executable: /home/alex/py3/bin/python
Python Version: 3.4.0
Python Path:
['/home/alex/PycharmProjects/JobTest',
'/home/alex/py3/lib/python3.4',
'/home/alex/py3/lib/python3.4/plat-x86_64-linux-gnu',
'/home/alex/py3/lib/python3.4/lib-dynload',
'/usr/lib/python3.4',
'/usr/lib/python3.4/plat-x86_64-linux-gnu',
'/home/alex/py3/lib/python3.4/site-packages',
'/home/alex/PycharmProjects/JobTest/JobTest',
'/home/alex/PycharmProjects/JobTest/apps',
'/home/alex/PycharmProjects/JobTest/libs']
Server time: Sun, 23 Aug 2015 07:00:19 -0700
Error during template rendering
In template /home/alex/PycharmProjects/JobTest/apps/base/templates/base/login.html, error at line 8
crispy tag's template_pack argument should be in ('bootstrap', 'uni_form', 'bootstrap3')
1 {% extends 'base.html' %}
2 {% load crispy_forms_tags %}
3
4 {% block main_content %}
5
6
7
8
{% crispy login_form %}
.......................................
from crispy-forms-foundation.
crispy-forms-foundation==0.5.2
django-crispy-forms==1.5.1
Django==1.8.3
from crispy-forms-foundation.
Seems you are using the tag like this {% crispy form 'bootstrap' %}
in your template with a form that does not set an helper, can you confirm ?
You should avoid this exception either adding an helper to your form or defining the setting CRISPY_ALLOWED_TEMPLATE_PACKS
with something like this :
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'foundation-5')
I'm awaiting your confirm about crispy tag usage to update the documentation about this problem, thanks.
from crispy-forms-foundation.
Looks like CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'foundation-5') helps. After all, I made a hard mix with crispy-forms(including some bootstrap parts) and your module, think it was a problem too. Problem not in tag. -
My form
class LoginForm(forms.Form):
login = forms.CharField(label=_('Login'), widget=forms.TextInput(attrs={'required':''}), required=True, max_length=30)
password = forms.CharField(label=_('Password'), widget=forms.TextInput(attrs={'required':''}), required=True, max_length=30)
def __init__(self, *args, **kwargs):
# Init layout form with crispy
self.helper = FormHelper()
self.helper.form_id = 'id-LoginForm'
self.helper.form_method = 'post'
self.helper.form_action = '.'
self.helper.form_error_title = 'Oooops...'
self.helper.form_show_labels = False
# self.helper.attrs = {'data_abide': ''}
self.helper.form_action = '.'
self.helper.layout = Layout(
Fieldset(
_('Authentification'),
'login',
'password',
),
ButtonHolder(
Submit('submit', _('Send'),css_class='large-offset-6 margintop-10 button round'),
),
)
super(LoginForm, self).__init__(*args, **kwargs)
View
def login_view(request):
redirect_url = request.GET.get('next')
if request.method == 'POST':
login_form = LoginForm(request.POST)
if login_form.is_valid():
username = login_form.cleaned_data['login']
password = login_form.cleaned_data['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return redirect(redirect_url or "base:home")
else:
messages.error(request, "user is not active")
else:
messages.error(request, "ask your administrator to create account for you!")
return render(request, "base/login.html", context={'login_form': login_form})
Template
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block main_content %}
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
{% crispy login_form %}
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li
{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</div>
{% endblock main_content %}
from crispy-forms-foundation.
Great support as for open source project, David ;-) Thanks a lot!
from crispy-forms-foundation.
Reopening this until i update the doc about settings.CRISPY_ALLOWED_TEMPLATE_PACKS to set because it seems a requirement since crispy 1.5.x
from crispy-forms-foundation.
Thank you so much. ran into similar problem, couldnt solve it for days. You saved me
from crispy-forms-foundation.
I had this error too
from crispy-forms-foundation.
Related Issues (20)
- Form filefield is a bit ugly HOT 3
- CSS classes bugs with crispy>=1.5.x HOT 3
- Foundation 6 Support HOT 10
- New layout elements to make real <button> ?
- Django 1.11 support? HOT 3
- Django 2.0 error HOT 5
- "required" added for FileFields even when there's already a file HOT 1
- Respect helper.field_template in templates
- Including the template for checkboxselectmultiple.html in the page means it cannot be overridden in the form HOT 1
- Possibility to add "data-" elements into <div> HOT 1
- Django 3 support! HOT 1
- Missing row.html and column.html templates in 0.8.0 HOT 3
- Django 4.0 support HOT 1
- sequence item 1: expected str instance, BoundField found HOT 4
- TypeError: 'Pointer' object is not subscriptable with crispy-forms>=2.0 HOT 2
- Foundation 5 HOT 4
- Foundtion 5 alert boxes errors HOT 1
- templates / foundation-5 / field.strict.html HOT 1
- Add Python 3 support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crispy-forms-foundation.