On Fri, Dec 4, 2009 at 6:23 AM, Margie Roginski
<margierogin...@yahoo.com> wrote:
> In forms/models.py I see this:
>
>    def save_m2m():
>        opts = instance._meta
>        cleaned_data = form.cleaned_data
>        for f in opts.many_to_many:
>            if fields and f.name not in fields:
>                continue
>            if f.name in cleaned_data:
>                f.save_form_data(instance, cleaned_data[f.name])
>
>
> Shouldn't it be looking at the exclude argument that save_instance
> received and avoid saving any m2m fields that are in exclude?  IE, I
> would think it should be like this instead:
>
>    def save_m2m():
>        opts = instance._meta
>        cleaned_data = form.cleaned_data
>        for f in opts.many_to_many:
>            if fields and f.name not in fields:
>                continue
>            if exclude and f.name in exclude:   <=== added this if
> clause
>                continue
>            if f.name in cleaned_data:
>                f.save_form_data(instance, cleaned_data[f.name])

Looks like you could be on to something. However, if you want to
convince us that you've found a bug, you can't just point at a line of
code - you need to provide a test case. Ideally, this would be a patch
against Django's test suite, but even a sample set of models and code
would suffice.

Yours,
Russ Magee %-)

--

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.


Reply via email to