Commit 3c4cba7d94bc127de9396406a8c9b26f81eefd45
1 parent
97689c87
Exists in
master
and in
2 other branches
Fixing new staff user unable to access categories list error
Showing
2 changed files
with
33 additions
and
50 deletions
Show diff stats
amadeus/templates/base.html
... | ... | @@ -108,50 +108,34 @@ |
108 | 108 | </div> |
109 | 109 | |
110 | 110 | <ul class="nav navbar-nav navbar-right notifications"> |
111 | - | |
112 | - | |
113 | - <li class="dropdown language-selector-on-header {{ settings_menu_active }}" title data-original-title="{% trans 'Language Selector' %}" style="width:40px;"> | |
114 | - | |
115 | - | |
116 | - | |
111 | + <li class="dropdown language-selector-on-header" title data-original-title="{% trans 'Language Selector' %}" style="width:40px;"> | |
117 | 112 | <a href="#" class="dropdown-toggle title" data-toggle="dropdown" data-close-others="true"> |
118 | 113 | <i class="fa fa-cog hidden-xs" aria-hidden="true"></i> |
119 | 114 | <span class="visible-xs-inline">{% trans 'Language Selector' %}</span> |
120 | 115 | {% with 'img/'|add:LANGUAGE_CODE|add:'.png' as image_static %} |
121 | - <img src="{% static image_static %}" /> | |
116 | + <img src="{% static image_static %}" /> | |
122 | 117 | {% endwith %} |
123 | 118 | </a> |
124 | 119 | <a href="#" class="dropdown-toggle no-title" data-toggle="dropdown" style="padding-left:0px;padding-right:0px;font-size:14px;text-align:center" data-close-others="true"> |
125 | - | |
126 | - <span>[{{LANGUAGE_CODE}}]</span> | |
127 | - | |
120 | + <span>[{{LANGUAGE_CODE}}]</span> | |
128 | 121 | </a> |
129 | 122 | <ul class="dropdown-menu"> |
130 | - | |
131 | - | |
132 | 123 | {% get_available_languages as LANGUAGES %} |
133 | 124 | {% get_language_info_list for LANGUAGES as languages %} |
134 | 125 | {% for language in languages %} |
135 | - | |
136 | - <li {% if language.code == LANGUAGE_CODE %} | |
137 | - class="active" | |
138 | - {% endif %}> | |
126 | + <li {% if language.code == LANGUAGE_CODE %}class="active"{% endif %}> | |
139 | 127 | <a class="language-item" value-lang="{{language.code}}"> |
140 | 128 | <span>{{language.code}}</span> |
141 | 129 | </a> |
142 | 130 | </li> |
143 | - | |
144 | 131 | {% endfor %} |
145 | 132 | </ul> |
146 | 133 | </li> |
147 | - <li style="width:40px;"> | |
148 | - <a href="{% url 'themes:contrast' %}" id="contrast_button"> | |
149 | - <i style="font-size:15px;right: 150%;" class="glyphicon glyphicon-adjust"></i> | |
150 | - </a> | |
151 | - | |
152 | - </li> | |
153 | - | |
154 | - | |
134 | + <li style="width:40px;"> | |
135 | + <a href="{% url 'themes:contrast' %}" id="contrast_button"> | |
136 | + <i style="font-size:15px;right: 150%;" class="glyphicon glyphicon-adjust"></i> | |
137 | + </a> | |
138 | + </li> | |
155 | 139 | <li id="profile-menu" class="dropdown" data-toggle="tooltip" data-placement="bottom" title data-original-title="{{ user }}"> |
156 | 140 | <a href="" data-toggle="dropdown" class="dropdown-toggle profile"> |
157 | 141 | <img src="{{ user.image_url }}" class="hidden-xs" style="width:50px;height:50px" /> |
... | ... | @@ -166,7 +150,7 @@ |
166 | 150 | </ul> |
167 | 151 | </li> |
168 | 152 | |
169 | - {% if user.is_staff %} | |
153 | + {% if user.is_staff %} | |
170 | 154 | <li id="staff-menu" style="width:40px;" class="dropdown {{ settings_menu_active }}" title data-original-title="{% trans 'settings' %}"> |
171 | 155 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
172 | 156 | <i class="fa fa-cog hidden-xs" style="position:relative;right:150%;"aria-hidden="true"></i> |
... | ... | @@ -175,7 +159,7 @@ |
175 | 159 | <ul class="dropdown-menu" role="menu"> |
176 | 160 | <li><a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> |
177 | 161 | <li><a href="{% url 'categories:index' %}">{% trans 'Manage Categories' %}</a></li> |
178 | - <li><a href="{% url 'news:manage_news' %}">{% trans 'Manage News' %}</a></li> | |
162 | + <li><a href="{% url 'news:manage_news' %}">{% trans 'Manage News' %}</a></li> | |
179 | 163 | <li class="dropdown-accordion" data-accordion="#system_accordion"> |
180 | 164 | <div class="panel-group" id="system_accordion"> |
181 | 165 | <div class="panel panel-default"> |
... | ... | @@ -205,19 +189,20 @@ |
205 | 189 | </ul> |
206 | 190 | </div> |
207 | 191 | </div> |
208 | - <script type="text/javascript"> | |
209 | - $("#contrast_button" ).click(function() { | |
210 | - if (Cookies.get('contrast_check')) { | |
211 | - Cookies.remove('contrast_check') | |
212 | - //location.reload() | |
213 | - } | |
214 | - else { | |
215 | - Cookies.set('contrast_check','contrast') | |
216 | - //location.reload() | |
217 | - } | |
218 | - | |
219 | - }); | |
220 | - </script> | |
192 | + | |
193 | + <script type="text/javascript"> | |
194 | + $("#contrast_button" ).click(function() { | |
195 | + if (Cookies.get('contrast_check')) { | |
196 | + Cookies.remove('contrast_check') | |
197 | + //location.reload() | |
198 | + } | |
199 | + else { | |
200 | + Cookies.set('contrast_check','contrast') | |
201 | + //location.reload() | |
202 | + } | |
203 | + | |
204 | + }); | |
205 | + </script> | |
221 | 206 | {% endblock %} |
222 | 207 | |
223 | 208 | <div class="container-fluid"> |
... | ... | @@ -323,16 +308,14 @@ |
323 | 308 | |
324 | 309 | <!-- Language selector code --> |
325 | 310 | |
326 | - <script> | |
327 | - $(".language-item").click(function(event) { | |
328 | - | |
329 | - change_language.post("{% url 'set_language' %}", {'language': $(this)[0].attributes[1].value, next: "{% url 'users:login' %}", csrfmiddlewaretoken: '{{ csrf_token }}' } ); | |
311 | + <script> | |
312 | + $(".language-item").click(function(event) { | |
330 | 313 | |
331 | - }); | |
332 | - </script> | |
333 | - <div id="remove_acc"> | |
314 | + change_language.post("{% url 'set_language' %}", {'language': $(this)[0].attributes[1].value, next: "{% url 'users:login' %}", csrfmiddlewaretoken: '{{ csrf_token }}' } ); | |
334 | 315 | |
335 | - </div> | |
316 | + }); | |
317 | + </script> | |
318 | + <div id="remove_acc"></div> | |
336 | 319 | </body> |
337 | 320 | |
338 | 321 | </html> | ... | ... |
categories/views.py
... | ... | @@ -25,7 +25,7 @@ import time |
25 | 25 | from topics.models import Topic, Resource |
26 | 26 | from users.models import User |
27 | 27 | |
28 | -class IndexView(views.SuperuserRequiredMixin, LoginRequiredMixin, ListView): | |
28 | +class IndexView(LoginRequiredMixin, views.StaffuserRequiredMixin, ListView): | |
29 | 29 | |
30 | 30 | login_url = reverse_lazy("users:login") |
31 | 31 | redirect_field_name = 'next' |
... | ... | @@ -62,7 +62,7 @@ class IndexView(views.SuperuserRequiredMixin, LoginRequiredMixin, ListView): |
62 | 62 | |
63 | 63 | return context |
64 | 64 | |
65 | -class CreateCategory(views.SuperuserRequiredMixin, LoginRequiredMixin, HasRoleMixin, LogMixin, CreateView): | |
65 | +class CreateCategory(LoginRequiredMixin, views.StaffuserRequiredMixin, LogMixin, CreateView): | |
66 | 66 | log_component = 'category' |
67 | 67 | log_action = 'create' |
68 | 68 | log_resource = 'category' | ... | ... |