Hi there,

Hopefully an easy question. I've overridden save_model() in my admin page, 
and I'm wrapping my obj.save() call in a try/catch so that I can catch a 
RecordModifiedError. 

    def save_model(self, request, obj, form, change):
             
        from concurrency.exceptions import RecordModifiedError
        from django.http import HttpResponse
        try: 
                
            obj.save()
            #other stuff

        except RecordModifiedError:
            self.message_user(request,
                            "[!] Record modified. Please try again.",
                            level="error")
            return None

The message saying record modified is shown when it should be. However, 
there is also a message at the top saying that the save was successful, 
when in fact it was not. 
What's the proper way to stop the success message from occurring? Can I 
clear it, or stop the request? Return None doesn't seem to help.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd5f2939-1e86-4d6b-97e3-c993a9d98293%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to