Hi folks --

I have a model that needs additional processing done every time an
instance is saved, so I've hooked up a handler to the post_save
signal.  The post_save handler will throw an exception if anything
goes wrong.

When the user saves a model from contrib.admin, I want the exception
to be caught and result in a notice to the user, but not a server
error.  So I tried the following in my ModelAdmin subclass:

class MyModelAdmin(admin.ModelAdmin):
        def save_form(self, request, form, change):
                try:
                        ret = super(MyModelAdmin, self).save_form(request, 
form, change)
                except MyCustomException:
                        print 'caught'
                        # ... do stuff
                return ret

However, the exception is not being caught.  Where do I need to catch
the exception in order to handle it gracefully?

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

Reply via email to