diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-09-22 03:17:28 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-09-22 03:17:28 +0000 |
| commit | 0fee26935dc5ceae35d19e0c85321df4013d3701 (patch) | |
| tree | 013e6f9733d2a42820f891d2faa0255878f4514f /django/core | |
| parent | 8feee92045294e7d5baa0bd493b20ac5ddaa3385 (diff) | |
Fixed #2747 -- Make X-Headers work for staff members. Admins with dyanmic IP
addresses can now use bookmarklets. Thanks, Maximillian Dornseif.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/xheaders.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/core/xheaders.py b/django/core/xheaders.py index e173bcbca8..69f6115839 100644 --- a/django/core/xheaders.py +++ b/django/core/xheaders.py @@ -13,9 +13,10 @@ def populate_xheaders(request, response, model, object_id): """ Adds the "X-Object-Type" and "X-Object-Id" headers to the given HttpResponse according to the given model and object_id -- but only if the - given HttpRequest object has an IP address within the INTERNAL_IPS setting. + given HttpRequest object has an IP address within the INTERNAL_IPS setting + or if the request is from a logged in staff member. """ from django.conf import settings - if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: + if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff): response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower()) response['X-Object-Id'] = str(object_id) |
