﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21946	Calling get_object() on DeleteView resets the success_url	django@…	nobody	"I was trying to do something with the object in the `def delete(self, request, *args, **kwargs)` method for a `DeleteView`, but found that calling `self.get_object()` *after* calling through to `super().delete(...)` causes problems:

{{{
class MyDeleteView(DeleteView):
    success_url = ""/finish/""

    def delete(self, request, *args, **kwargs):
        response = super(MyDeleteView, self).delete(request, *args, **kwargs)
        object = self.get_object()
        # ... do something with object (or not)
        return response

# urls.py:
...
url(r'^thing/delete/(?P<pk>\d+)/, views.MyDeleteView.as_view(), name=""thing_delete"")
...

}}}

I'd expect this code to work, and that upon returning response you are redirected to `success_url` (i.e. `/finish/`). Instead, you are redirected back to the delete page, so if my `Thing` has a `pk=1`, then I would be redirected to `/thing/delete/1/`

Now if I call `get_object()` *before* the call through to `super` everything works fine. It seems calling `get_object()` resets the `success_url`.

I'm not sure if what I'm trying to do is not normal behaviour, but I'd have thought that trying to do something once an object has successfully been delete (i.e. only *after* the call to `super(...).delete(...)` has been made) should be OK.
In this case, I'm trying to send an email saying `""Successfully deleted {object}""`"	Uncategorized	closed	Generic views	1.6	Normal	worksforme			Unreviewed	0	0	0	0	0	0
