form.is_valid() changes a ModelForm's associated instance

2011-10-23 Thread Torsten Bronger
Hallöchen! I was bitten by this behaviour today, so I'd like to revisit an old subject: See . If I give an "instance" to a model form constructor and later on call ".is_valid()" on that form, the given instance is changed in place.

Re: form.is_valid() changes a ModelForm's associated instance now?

2011-03-24 Thread Vermus
>     item = Item.objects.get(id=1) >     print 'item.value: %s' % item.value >     form = ItemModelForm(request.POST, instance=item) >     # NOTE: This fixes the problem: >     old_item = copy.deepcopy(item) >     if form.is_valid(): >         print 'old_item.value: %s' % old_item.value >        

form.is_valid() changes a ModelForm's associated instance now?

2011-03-02 Thread Jumpfroggy
I discovered the recent changes to the "is_valid()" model form method in 1.2, and I'd love to hear thoughts on the rationale behind this change. I have this kind of code: item = Item.objects.get(id=1) print 'item.value: %s' % item.value form = ItemModelForm(request.POST, instance=item