On Jan 6, 2010, at 2:48 PM, Łukasz Rekucki wrote:

> Maybe you could do something like this:
> 
> with form.valid_model() as model: # i'm not good at inventing names
>     model.user = request.user
>     model.primary_contact = somecontact
> 
> The valid_model() would be a context manager that does form validation and 
> form.save(commit=False) on enter + model validation and save() on exit. Of 
> course this will only work on Python 2.5+, so it's probably no good for 
> django 1.2. Just wanted to share an idea.

FTR, this is a pretty neat idea. The naming is a bit off, but that can be 
worked out. Unfortunately, we couldn't much with it now, but I'd like to look 
at the possibility for 1.3. Thanks for sharing.

Brian Rosner
http://oebfare.com
http://twitter.com/brosner

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


Reply via email to