On Thu, Feb 24, 2011 at 1:07 PM, Mike Ramirez <gufym...@gmail.com> wrote:
> On Thursday, February 24, 2011 05:00:23 am galago wrote:
>> class ProvinceForm(ModelForm):
>
>> def __init__(self, *args, **kwargs):
>> <snip>
>
> for self.instance, you'll wnat to do something like this:
>
> self.instance = kwargs.pop('instance')
>
> or add:
>
> def __init__(self, instance, *args, **kwargs):
>
> self.instance = instance
>
> as for the blank items, verify your query works as expected. After that I'm
> not sure.
>
> Mike
>

Er, no, he should be calling the super-class (ModelForm) constructor,
which would correctly handle instance being in kwargs and set
self.instance - which the OP is doing. Cargo cult programming is bad.

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to