Kurczak;

Short of this is, catching specific errors in the save method and
displaying them to the user are hard and you might be regurgitating
items back to the user that they really don't have any business seeing
(SQL errors, programming errors, etc.). The best way to check for the
proper values is to do it at the form level. If you are in the admin
you have the ability to define a custom form; the admin docs explain
this pretty well: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form
. If this is a custom input of your form, you save one step and do it
in the clean methods on your form.

In this way you are avoiding the model validation on the save method
and you have clean modular and specific errors that can be displayed
to the user.

Hope that helps,

Michael

On Oct 2, 4:22 am, Kurczak <[EMAIL PROTECTED]> wrote:
> Hello there,
> I'm in  need of some kind of validation at model level (and don't have
> time to wait till 1.1 lands). Now I'm doing it by raising exceptions
> in save method (I know how ugly it sounds).
> What can I do to propagate those exceptions to forms or handle them at
> some user-friendly level (so at least i can show some nice error
> page).
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to