Hello all,

I have a model where I've overridden the save method.  In a specific
case (validation fails against an external web service), I would like
to prevent the save from happening.  I have implemented this by not
calling super.save in this case.

(see 
http://www.djangoproject.com/documentation/model-api/#overriding-default-model-methods)

The problem I'm running into is that when a create/save is initiated
from the admin interface, I have no way of alerting the user that the
save was not successful.  Since the form validates, the admin screen
returns with the "____ was added successfully" message.

Here are the three paths I've gone down:

1) I can call get_and_delete_messages() on the user, then add my own
new message, however a) this seems a bit hacky, and b) I don't have
access to the request inside model.save.

2) I can override save_add in admin, but I would like to avoid having
to duplicate the extra logic I'm doing in save().

3) I can implement this step as a pre_save signal, but I found no way
to stop the save once things are in motion. (raise an exception?)

Am I missing something obvious?  Any thoughts?

Thanks!
Joe

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