equal
deleted
inserted
replaced
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) |