I have a view that has a decorator which redirects to admin login page as following
@login_required(login_url='/admin')
That means whenever a user tries to access /admin/some/url/ he will be asked to login through admin page at /admin/?next=/admin/some/url/
My question is: how do I handle redirecting after the user has logged in via the admin page?
/admin/?next=/admin/some/url/ -> /admin/some/url/
I assume that I need to tweak my app's urlpatterns and use redirect_to from
django.views.generic.simple
and overwrite
(r'^admin/', include(admin.site.urls))
P.S: To simplify this question: I need a regex to match /admin/some/url/ in /admin/?next=/admin/some/url/ so I can use it for my redirect_to function