Hi,

Nothing prevents you to put your tests in the form_valid and render the same 
page with your errors.

Regards,
Xavier,
Linovia.

Le 22 sept. 2011 à 17:14, Kurtis a écrit :

> Hey,
> 
> I'm trying to figure out the best way to do this. I have a FormView
> and an associated Form. In my Form, I take care of all of the
> validation and cleaning as far as the input goes.
> 
> However, I need to put in some more logic such as saving the user,
> logging in a user, and whatever else the future holds. I can do this
> in my Class Based View just fine within the is_valid() method.
> 
> The problem comes when I need to raise an exception. I'm not sure what
> kind of an exception to raise or how to present it back to the user.
> For example, if a user tries to create an account and the email
> address is already in use, I want to be able to display that message
> to them with the form.
> 
> I know that authentication is a bad example on this since most of this
> really could be done from the Form. But I have a feeling that in the
> future there will be places I need to actually do this stuff from the
> View itself.
> 
> Are there any suggestions on a good, or conventional, way to do this?
> Basically it boils down to this -- with Class Based FormViews, should
> the logic for *everything* be pushed into the Form itself? Or should
> it be split up between the Form (validation) and the View (everything
> else) like I am trying to do?
> 
> Any examples would also be very helpful!
> 
> Thanks
> 
> -- 
> 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.
> 

-- 
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