We have middleware that records the last url the user has visited:

class LastSiteUrl(object):

    def is_admin_url(self, url):
        if re.search('^(http:\/\/.*){0,1}\/admin\/', url) is None: return(False)
        else: return(True)

    def process_request(self, request):
        if self.is_admin_url(request.path) and \
            not self.is_admin_url(request.META['HTTP_REFERER']):
            request.session['last_site_url'] = request.META['HTTP_REFERER']

We use this to return them back to the last app page they were at,
from an admin page, no matter how deep into admin they were. This is
working fine.

We have a custom 404 page, and from there I want to provide a link to
take them back to where they were in the app. But it seems the
middleware does not run when they go to an invalid page. Is there a
way to make it run in that case as well?

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