django-crispy-forms

ImportError: No module named crispy-forms

﹥>﹥吖頭↗ 提交于 2019-12-09 09:20:22
问题 I'm working on some django apps, pretty noob still. Would like to use crispy-forms, but eclipse and django doesnt recognize it. Trying to runserver or shell: $ python manage.py runserver this happens: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages

ImportError: No module named bootstrap3

为君一笑 提交于 2019-12-08 15:36:48
问题 I installed bootstrap3 with $ pip install django-bootstrap3 It is being installed in this directory /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/ Django seems to be looking at this directory /Users/shawnpike/anaconda/lib/python2.7/site-packages/django/ When I put 'bootstrap3' in the INSTALLED_APPS = ('bootstrap3') variable and then run $ python manage.py runserver I get this error Traceback (most recent call last): File "manage.py", line 10, in <module>

'list' object has no attribute 'queryset' error when adding a autocomplete field to a model-form

寵の児 提交于 2019-12-08 13:43:10
问题 I want to add an another autocomplete field to my model.form. However, as soon as I add the autocomplete widget for the field "projektnummer" 'projektnummer': autocomplete.ModelSelect2(url='output:projekt-form-autocomplete'), I get an wired template error I cannot make sense of. Do you have some ideas what I can do here? Thank you very much! :) error message: AttributeError at /output/create/ 'list' object has no attribute 'queryset' Request Method: GET Request URL: http://127.0.0.1:8000

django crispy forms overriding layout objects templates ignored

懵懂的女人 提交于 2019-12-08 11:31:31
问题 I applied this thus I have self.helper.layout = Layout( Field( 'title', template="mytemplate.html" ) , As result my template is not rendered helper.field_template is None in below code : (C:\myapp\lib\crispy_forms\templatetags\crispy_forms_filters.py): @register.filter(name='as_crispy_field') def as_crispy_field(field, template_pack=TEMPLATE_PACK, label_class="", field_class=""): """ Renders a form field like a django-crispy-forms field:: {% load crispy_forms_tags %} {{ form.field|as_crispy

'FormHelper' object has no attribute 'append' while using crispy_forms in django

馋奶兔 提交于 2019-12-07 09:11:59
问题 I'm new to Django, and I am trying to style forms with crispy forms. I have a form in my app which happens to be a modelform, and I've followed what has been said here https://stackoverflow.com/a/13201588/1076075 to make ModelForm work with crispy_forms, but getting this error: 'FormHelper' object has no attribute 'append' This is how my code looks in forms.py : from django import forms from models import Ticket, Ticketuser from crispy_forms.helper import FormHelper from crispy_forms.layout

Crispy Form VariableDoesNotExist on Django

南楼画角 提交于 2019-12-07 04:45:09
问题 For crispy form on Django, I keep getting VariableDoesNotExist at / Failed lookup for key [form] in u'[{\'False\': False, \'None\': None,..... {% extends 'base.html' %} {% load crispy_forms_tags %} {% block loginForm %} <div class="container" style="padding-bottom: 70px;"> <div class='row'> <div class='col-md-6 col-md-offset-3'> <div class="well"> <legend>Sign in</legend> <form method="post" action="{% url 'django.contrib.auth.views.login' %}" class="form-horizontal"> {% crispy form %} <input

django-autocomplete-light - how to return a different field then a models primary key?

感情迁移 提交于 2019-12-06 08:49:25
问题 I am using django-autocomplete-light in a form for a model I want to use autocomplete on one of its field. the field is not a foreignkey or something, but just a integer field and for autocomplete I would actually like to use the same model then the form I am filling. The query set from autocomplete however returns the ID and I want to fill the field "projektnummer". Any clue how I can setup autocomplete so that it returns not the primary key of the model but some other field? also it seems

Nested and Segmented Crispy Layouts

末鹿安然 提交于 2019-12-06 06:59:06
TLDR Question: How do you make one crispy form with a ¿segmented?(not sure if this is considered inline) layout with multiple models(some related, some not). I am trying to understand several things in Django: forms, formsets, nested forms, and crispy, and I've been at it for a while, and feel I am close, just need someone to help connect the dots. I'm not sure how to accomplish it without crispy, so I started down this path thinking crispy was the solution. Please correct if I am wrong, thanks :) I would like one form (as in HTML form, not necessarily Django Form), that has a primary model

Django crispy-forms cannot find CSS

╄→尐↘猪︶ㄣ 提交于 2019-12-05 18:27:33
I am using Django and Crispy Forms. I can get the form to render correctly, but no CSS formatting appears. What do I need to do? I have added CRISPY_TEMPLATE_PACK = 'bootstrap' to my settings.py file. The html file is as simple as it gets: {% extends 'base.html' %} {% load crispy_forms_tags %} {% block content %} {% crispy form %} {% endblock %} What else is necessary to make it work? I understand that since the bootstrap files come bundled with crispy_forms, I don't need to copy and reference them specifically in my project's CSS path. Is this correct? It sounds as if your django instance can

Rendering field errors in django-crispy-forms with inline forms

六月ゝ 毕业季﹏ 提交于 2019-12-05 03:56:37
I'm using bootstrap3 as the default template pack in django_crispy_forms, and trying to render a form with the crispy tag: {% crispy form %} My form class has the following helper attributes: class TheForm(forms.Form): adv_var = forms.CharField(label="variable", max_length=70) value = forms.FloatField() def __init__(self, *args, **kwargs): super(TheForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_class = 'form-inline' self.helper.field_template = 'bootstrap3/layout/inline_field.html' self.helper.layout = Layout( 'adv_var',