Python django.conf.settings.ADMIN_URL Examples

The following are 1 code examples of django.conf.settings.ADMIN_URL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.conf.settings , or try the search function .
Example #1
Source File: middleware.py    From esdc-ce with Apache License 2.0 6 votes vote down vote up
def process_request(self, request):
        request.impersonated = False
        if request.user.is_staff and 'impersonate_id' in request.session:
            user_id = request.session['impersonate_id']
            if user_id:
                try:
                    new_user = User.objects.get(id=user_id)
                except User.DoesNotExist:
                    del request.session['impersonate_id']
                else:
                    request.impersonated = True
                    if request.path.startswith('/' + settings.ADMIN_URL):
                        request.new_user = new_user
                    else:
                        request.real_user = request.user
                        request.user = new_user
            else:
                del request.session['impersonate_id']