django-crispy-forms

Bootstrap3 inline forms in django-crispy-forms not showing form errors

吃可爱长大的小学妹 提交于 2019-12-05 03:27:09
I am using django-crispy-forms to render a Bootstrap3 inline form (code shown below), but the errors upon form submission (like skipping required fields) are not being shown. They do in normal and horizontal form layouts. Could someone please suggest the possible reason(s)? Models.py class Person(models.Model): name = models.CharField(max_length=500) city = models.CharField(max_length=50) country = models.CharField(max_length=50) email = models.EmailField(blank=True) Forms.py class EntryForm(forms.ModelForm): class Meta: model = Person def __init__(self, *args, **kwargs): super(EntryForm, self

django crispy-forms inline forms

元气小坏坏 提交于 2019-12-04 23:40:44
问题 I'm trying to adopt crispy-forms and bootstrap and use as much of their functionality as possible instead of inventing something over and over again. Is there a way to have inline forms functionality with crispy-forms/bootstrap like django-admin forms have? Here is an example: class NewProjectForm(forms.Form): name = forms.CharField(required=True, label=_(u'Название проекта'), widget=forms.TextInput(attrs={'class':'input-block-level'})) group = forms.ModelChoiceField(required=False, queryset

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

随声附和 提交于 2019-12-04 14:17:44
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 that I get a wired failure from crispy forms when I use the autocomplete-widget on the integer field.

crspy-forms layout not work for django inline formset

大城市里の小女人 提交于 2019-12-03 21:48:46
This is my forms and inlineformset class EventForm(ModelForm): def __init__(self, *args, **kwargs): super(EventForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = Layout( Field('name'), Field('description'), Field('tags'), ) self.helper.layout.append(Submit('save', 'Save')) class Meta: model = Event fields = ('name','description','tags', ) class GalleryForm(ModelForm): def __init__(self, *args, **kwargs): super(GalleryForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False self.helper.form

django crispy-forms inline forms

帅比萌擦擦* 提交于 2019-12-03 15:28:58
I'm trying to adopt crispy-forms and bootstrap and use as much of their functionality as possible instead of inventing something over and over again. Is there a way to have inline forms functionality with crispy-forms/bootstrap like django-admin forms have? Here is an example: class NewProjectForm(forms.Form): name = forms.CharField(required=True, label=_(u'Название проекта'), widget=forms.TextInput(attrs={'class':'input-block-level'})) group = forms.ModelChoiceField(required=False, queryset=Group.objects.all(), label=_(u'Группа проектов'), widget=forms.Select(attrs={'class':'input-block-level

ImportError: No module named crispy-forms

最后都变了- 提交于 2019-12-03 12:06:26
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/django/core/management/__init__.py", line 354, in execute django.setup() File "/usr/local/lib/python2.7

get two fields inline in django-crispy forms but not others horizontal?

故事扮演 提交于 2019-12-03 09:45:33
问题 I want to have two fields corresponding to check boxes next to next (not one below other) like I have shown in the image. my form inherits from models.Form and has other fields, which I have left out here. is it possible to get this using crispy-forms? For rest of the fields, I use self.helper.form_class='form-horizontal' , which I want to keep intact for other form fields Thanks 回答1: This is untested but I think this will work. self.helper.layout = Layout( Div( Div('inlineField1',css_class=

How to render Django forms.ChoiceField as Twitter Bootstrap dropdown

寵の児 提交于 2019-12-03 03:08:18
问题 What is the most efficient way (in terms of programming/maintenance effort, elegance) to render a Django forms.ChoiceField as a Twitter Bootstrap dropdown using one of the django-bootstrap, django-bootstrap-form, django-bootstrap-toolkit, django-crispy-forms, etc apps? Is there explicit support for this use case in any of these apps? 回答1: Disclaimer I'm the lead developer of django-crispy-forms (one of the apps mentioned). I will try to explain how you do this with django-crispy-forms. You

get two fields inline in django-crispy forms but not others horizontal?

余生长醉 提交于 2019-12-03 01:27:09
I want to have two fields corresponding to check boxes next to next (not one below other) like I have shown in the image. my form inherits from models.Form and has other fields, which I have left out here. is it possible to get this using crispy-forms? For rest of the fields, I use self.helper.form_class='form-horizontal' , which I want to keep intact for other form fields Thanks This is untested but I think this will work. self.helper.layout = Layout( Div( Div('inlineField1',css_class='col-md-6',), Div('inlineField2',css_class='col-md-6',), css_class='row', ), 'other_fields', ..., FormActions

How to render Django forms.ChoiceField as Twitter Bootstrap dropdown

穿精又带淫゛_ 提交于 2019-12-02 17:09:16
What is the most efficient way (in terms of programming/maintenance effort, elegance) to render a Django forms.ChoiceField as a Twitter Bootstrap dropdown using one of the django-bootstrap, django-bootstrap-form, django-bootstrap-toolkit, django-crispy-forms, etc apps? Is there explicit support for this use case in any of these apps? Disclaimer I'm the lead developer of django-crispy-forms (one of the apps mentioned). I will try to explain how you do this with django-crispy-forms. You simply do in your template: {% load crispy_forms_tags %} {{ form|crispy }} You can see this and more in django