Python django.conf.settings.ADMIN_URL Examples

The following are 1 code examples for showing how to use django.conf.settings.ADMIN_URL(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.conf.settings , or try the search function .

Example 1
Project: esdc-ce   Author: erigones   File: middleware.py    License: 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']