Python django.conf.settings 模块,ADMIN_URL 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.conf.settings.ADMIN_URL

项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
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']