web/lib/django/core/xheaders.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
    16     given HttpRequest object has an IP address within the INTERNAL_IPS setting
    16     given HttpRequest object has an IP address within the INTERNAL_IPS setting
    17     or if the request is from a logged in staff member.
    17     or if the request is from a logged in staff member.
    18     """
    18     """
    19     from django.conf import settings
    19     from django.conf import settings
    20     if (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS
    20     if (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS
    21             or (hasattr(request, 'user') and request.user.is_authenticated()
    21             or (hasattr(request, 'user') and request.user.is_active
    22                 and request.user.is_staff)):
    22                 and request.user.is_staff)):
    23         response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower())
    23         response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower())
    24         response['X-Object-Id'] = str(object_id)
    24         response['X-Object-Id'] = str(object_id)