On Aug 11, 2010, at 7:25 PM, refreegrata wrote:
My code
----------------------------------
class Format(models.Model):
name = models.CharField(max_length=5, unique=True)
myBoolean = models.BooleanField(default=False)
class FormFormat(forms.ModelForm):
boolean1 = forms.BooleanField(required=False)
boolean2 = forms.BooleanField(required=False)
class Meta:
model = Format
fields = ['name']
FormsetFormFormat = forms.models.modelformset_factory(Format,
max_num=0,form=FormFormat)
----------------------------------
The idea is this:
if boolean1=True and boolean2=True the field myBoolean must to be True
if boolean1=True and boolean2=False the field myBoolean must to be
False
...
My question is, how i can do this?
overwriting the save method?
Possible, but I have a feeling there might be a nicer solution. What
do you want to happen if boolean1 is false?
I don't have idea, because boolean1 and boolean2 are form fields not
model fields. Can i pass custom parameters to the save method?
Yes, you can.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.