----------------------------------
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?

Well, i'm new one myself, but if i understand docs correctly, You can create form from model, then add b1 and b2 fields, and include only them for display by using 'fields' meta option.
Later, when form is valid, check b1 and b2, and set myBoolean

http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets


--
Linux user

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to