Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changed contrib.admin.views.template and doc to use staff_member_requ…

…ired decorator. Refs #627

git-svn-id: http://code.djangoproject.com/svn/django/trunk@929 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 15fb988dbc9f25e9e04eeb098370476c0bee1363 1 parent 530f8d1
Adrian Holovaty authored October 18, 2005
10  django/contrib/admin/views/doc.py
... ...
@@ -1,6 +1,7 @@
1 1
 from django.core import meta
2 2
 from django import templatetags
3 3
 from django.conf import settings
  4
+from django.contrib.admin.views.decorators import staff_member_required
4 5
 from django.models.core import sites
5 6
 from django.core.extensions import DjangoContext, render_to_response
6 7
 from django.core.exceptions import Http404, ViewDoesNotExist
@@ -19,11 +20,13 @@ def doc_index(request):
19 20
     if not doc:
20 21
         return missing_docutils_page(request)
21 22
     return render_to_response('doc/index', context_instance=DjangoContext(request))
  23
+doc_index = staff_member_required(doc_index)
22 24
 
23 25
 def bookmarklets(request):
24 26
     return render_to_response('doc/bookmarklets', {
25 27
         'admin_url' : "%s://%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST']),
26 28
     }, context_instance=DjangoContext(request))
  29
+bookmarklets = staff_member_required(bookmarklets)
27 30
 
28 31
 def template_tag_index(request):
29 32
     import sys
@@ -61,6 +64,7 @@ def template_tag_index(request):
61 64
     template.registered_tags, template.registered_filters = saved_tagset
62 65
 
63 66
     return render_to_response('doc/template_tag_index', {'tags': tags}, context_instance=DjangoContext(request))
  67
+template_tag_index = staff_member_required(template_tag_index)
64 68
 
65 69
 def template_filter_index(request):
66 70
     if not doc:
@@ -93,6 +97,7 @@ def template_filter_index(request):
93 97
     template.registered_tags, template.registered_filters = saved_tagset
94 98
 
95 99
     return render_to_response('doc/template_filter_index', {'filters': filters}, context_instance=DjangoContext(request))
  100
+template_filter_index = staff_member_required(template_filter_index)
96 101
 
97 102
 def view_index(request):
98 103
     if not doc:
@@ -112,6 +117,7 @@ def view_index(request):
112 117
                 'url'    : simplify_regex(regex),
113 118
             })
114 119
     return render_to_response('doc/view_index', {'views': views}, context_instance=DjangoContext(request))
  120
+view_index = staff_member_required(view_index)
115 121
 
116 122
 def view_detail(request, view):
117 123
     if not doc:
@@ -135,6 +141,7 @@ def view_detail(request, view):
135 141
         'body': body,
136 142
         'meta': metadata,
137 143
     }, context_instance=DjangoContext(request))
  144
+view_detail = staff_member_required(view_detail)
138 145
 
139 146
 def model_index(request):
140 147
     if not doc:
@@ -150,6 +157,7 @@ def model_index(request):
150 157
                 'class'  : opts.module_name,
151 158
             })
152 159
     return render_to_response('doc/model_index', {'models': models}, context_instance=DjangoContext(request))
  160
+model_index = staff_member_required(model_index)
153 161
 
154 162
 def model_detail(request, model):
155 163
     if not doc:
@@ -191,6 +199,7 @@ def model_detail(request, model):
191 199
         'summary': "Fields on %s objects" % opts.verbose_name,
192 200
         'fields': fields,
193 201
     }, context_instance=DjangoContext(request))
  202
+model_detail = staff_member_required(model_detail)
194 203
 
195 204
 def template_detail(request, template):
196 205
     templates = []
@@ -210,6 +219,7 @@ def template_detail(request, template):
210 219
         'name': template,
211 220
         'templates': templates,
212 221
     }, context_instance=DjangoContext(request))
  222
+template_detail = staff_member_required(template_detail)
213 223
 
214 224
 ####################
215 225
 # Helper functions #
2  django/contrib/admin/views/template.py
... ...
@@ -1,3 +1,4 @@
  1
+from django.contrib.admin.views.decorators import staff_member_required
1 2
 from django.core import formfields, validators
2 3
 from django.core import template
3 4
 from django.core.template import loader
@@ -26,6 +27,7 @@ def template_validator(request):
26 27
         'title': 'Template validator',
27 28
         'form': formfields.FormWrapper(manipulator, new_data, errors),
28 29
     }, context_instance=DjangoContext(request))
  30
+template_validator = staff_member_required(template_validator)
29 31
 
30 32
 class TemplateValidator(formfields.Manipulator):
31 33
     def __init__(self, settings_modules):

0 notes on commit 15fb988

Please sign in to comment.
Something went wrong with that request. Please try again.