Re: ModelForm enforces its version of save_m2m

2012-06-06 Thread is_null
Thanks for answering. It's "funny code" but it works indeed.

Thanks again

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/2_4X_NFZmP8J.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: ModelForm enforces its version of save_m2m

2012-05-25 Thread Stephen Burrows
It's definitely possible for users to support commit=False. If you call 
form.save(commit=False), you can then store form.save_m2m in a temporary 
variable, define a new save_m2m function, and then call the old function 
from the new. Here's sort of an example: 
https://github.com/pculture/mirocommunity/blob/31688f2/localtv/user_profile/forms.py#L76.
 
Does it a little differently, but the same result.

--Stephen

On Tuesday, May 22, 2012 2:53:00 AM UTC-7, is_null wrote:
>
> Hello everybody, 
>
> Currently, Django ModelForm enforces it's local version of save_m2m: 
>
> https://github.com/django/django/blob/38408f8007eae21b9f1cbbcc7f86d4b2042ff86a/django/forms/models.py#L76
>  
>
> As a result, users who want to overload save_m2m can not support 
> commit=False: 
> https://github.com/yourlabs/django-autocomplete-light/blob/master/autocomplete_light/contrib/generic_m2m.py#L50
>  
>
> Wouldn't it be great if users could overload save_m2m ? 
>
> If you agree, I volunteer to do the ticket and pull request. Else I'll 
> leave my hack in my app :( 
>
> Regards 
>

On Tuesday, May 22, 2012 2:53:00 AM UTC-7, is_null wrote:
>
> Hello everybody, 
>
> Currently, Django ModelForm enforces it's local version of save_m2m: 
>
> https://github.com/django/django/blob/38408f8007eae21b9f1cbbcc7f86d4b2042ff86a/django/forms/models.py#L76
>  
>
> As a result, users who want to overload save_m2m can not support 
> commit=False: 
> https://github.com/yourlabs/django-autocomplete-light/blob/master/autocomplete_light/contrib/generic_m2m.py#L50
>  
>
> Wouldn't it be great if users could overload save_m2m ? 
>
> If you agree, I volunteer to do the ticket and pull request. Else I'll 
> leave my hack in my app :( 
>
> Regards 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/V9VRuLelOfEJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



ModelForm enforces its version of save_m2m

2012-05-22 Thread James Pic
Hello everybody,

Currently, Django ModelForm enforces it's local version of save_m2m:
https://github.com/django/django/blob/38408f8007eae21b9f1cbbcc7f86d4b2042ff86a/django/forms/models.py#L76

As a result, users who want to overload save_m2m can not support
commit=False: 
https://github.com/yourlabs/django-autocomplete-light/blob/master/autocomplete_light/contrib/generic_m2m.py#L50

Wouldn't it be great if users could overload save_m2m ?

If you agree, I volunteer to do the ticket and pull request. Else I'll
leave my hack in my app :(

Regards

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