Hello,

It should be trivial to most of you...

When I create an instance form, do I need to explicitely transfer the
values of the fields that are not used in the form ?
(I mean with "transfer" : copy the values from the instance before
editing to the instance after editing).


Here is an example :
I have a model named Person which owns a boolean field (named "active"
such as to deactivate a person without suppressing the record in the
db).

I use that view (partim) :

 def person_edit(request, person_name):
   person = Person.objects.get(name__iexact=person_name)
   personForm = forms.models.form_for_instance(person)
   if request.method == 'POST':
       form = personForm(request.POST)
       if form.is_valid():
           p = form.save()
           ...

I don't use the "active" field in my form template. When I edit a
record, the "active" field becomes false.

I would have expected that the values of non-used fields would have
been kept unchanged.

I read the docs but I see no mention of this (or I missed it). Where
would I find exhaustive docs about this behaviour ? (I know an answer
: in the code ..., but something for simple humans).

Thanks,

Denis

-- 
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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