Thanks to the fantastic inline model formsets in django I have a pretty advanced form with 4 inline formsets. In the template I display each formset in a tab. Everything works really slick but I would like to color a tab red if the formset in that tab has any validation errors at all. So I tried this:
<div id="tabs">
<ul>
<l...
I have a from based on ModelForm and use formset_factory to create a formset based on two dictionaries. There is also one extra form.
In my view, I use the formset JS plugin and I delete the two forms with data. When I POST the remaining empty extra form, it fails validation because of a required field.
I don't understand why that form...
I have a form (not a model one) for a rsync front-end type. So I would like that when the user selects the source, it will get deleted from the destination choice. I'm new to python and django so forgive my ignorance. This is my forms.py:
from django import forms
class ChoiceForm(forms.Form):
source = forms.ChoiceField(choices=[(1,...
I've declared a formset like so:
class BaseFeatureFormSet(BaseFormSet):
def save(self, commit = True):
feature = Feature(name = self.cleaned_data['name'],
type = self.cleaned_data['type'],
premium = self.cleaned_data['premium'],)
feature.save()
return feature
Fea...
Hi,
I'm using app engine patch for an application on app engine. I have a model formset which works great for editing objects, but I can't use it for adding objects because I can't create an empty formset.
I want the user to be able to add multiple records at once, which I was I am using formsets.
In django, to create an empty formse...
When using a formset, you need to add {{formset.management_form}} to your form. This renders 3 fields, one of which is TOTAL_FORM_COUNT. I want to get the ID of this field so that I can modify its value via JS. How can I do that?
I'm trying stuff like formset.management_form.TOTAL_FORM_COUNT and .fields.TOTAL_FORM_COUNT to get the field...
formset.empty_form is great for generating a blank form that I can use in my JS. However, once the form has been posted, empty_form suddenly contains error messages and it magically forgets all its initial values. Why is that?
Instead, I have to do this stupid hack to get an actually empty form
empty_form = MyFormSet().empty_form
Reg...
How do i pre-populate the exclude fields in a ModelFormSet. AuthorFormSet below doesn't take an instance argument here, only queryset. So how do i force the empty forms coming in not to have a NULL/None user attribute. I want to be able to set that user field to request.user
models.py
class Author(models.Model):
user = models.Forei...
Hi guy's, im trying to use django formWizard, all is fine, but im getting an error in the last step after submit
Traceback (most recent call last):
File "/home/vacantes/webapps/django/lib/python2.6/django/core/handlers/base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/h...
I have a ModelForm as follows:
class ArticleForm(forms.ModelForm):
title = forms.CharField(max_length=200)
body = forms.CharField(widget=forms.Textarea)
new_status = forms.CharField(label="Status", max_length=1, widget=forms.Select(choices=APPS_ARTICLE_STATUS))
tags = forms.CharField(label="Generic Tags", max_length=200...
How can i go about making list that do this in Django.
I want it to look like:
Item A
add
Item B
add
Item C
add
where items are from Item models. When the add button is clicked, the item will be added to a list model.
I use modelformset so that i could get Item list which is already populated in the Item model. I have...
I have a ManyToMany field with a relationship model. I want a formset, filtered on one of the
keys, which shows a form for each of the other keys.
My guess is that a custom manager on the relationship model is the key to solving this problem. The manager would return "phantom" instances initialized with the appropriate ForeignKey when n...
I have a model like below.
class Content(SimpleModel):
title = models.CharField(max_length=255)
body = models.TextField()
slug = models.SlugField(max_length=50)
def __unicode__(self):
return self.title
class MediumStuff(models.Model):
meta_value = models.TextField()
meta_key = models.SlugField('Fie...
I am generating multple forms on one page using signals like:
def send_articleform(sender, form, request, type=None, nid=None, **kwargs):
if sender == 'article':
if nid == None:
if request != None:
formset = modelformset_factory(Article, form=ArticleModelForm)
form['article...