Remove filter options section from user view template and update permission checks in toggle function
This commit is contained in:
@@ -8,19 +8,6 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<a href='{% url "trainees" %}'>Trainees list</a>
|
<a href='{% url "trainees" %}'>Trainees list</a>
|
||||||
|
|
||||||
<div id="view-filter-options">
|
|
||||||
<details class="filter">
|
|
||||||
<summary>
|
|
||||||
<h3>Filter Users </h3>
|
|
||||||
</summary>
|
|
||||||
<form action="" method="get">
|
|
||||||
{{ filter.form| crispy }}
|
|
||||||
<input class="btn btn-primary btn-sm mt-1 mb-1" type="submit" />
|
|
||||||
</form>
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<details class="bulk-edit">
|
<details class="bulk-edit">
|
||||||
<summary>
|
<summary>
|
||||||
Bulk edit
|
Bulk edit
|
||||||
|
|||||||
+6
-2
@@ -669,8 +669,12 @@ def toggle_frcr_appropriate(request, pk):
|
|||||||
question = get_object_or_404(Question, pk=pk)
|
question = get_object_or_404(Question, pk=pk)
|
||||||
|
|
||||||
# Simple permission: allow staff or users with change permission
|
# Simple permission: allow staff or users with change permission
|
||||||
if not (request.user.is_staff or request.user.has_perm('sbas.change_question')):
|
if question.is_author(request.user):
|
||||||
return HttpResponseForbidden("Forbidden")
|
pass
|
||||||
|
elif request.user.groups.filter(name="sba_reviewer").exists():
|
||||||
|
pass
|
||||||
|
elif not (request.user.is_staff or request.user.has_perm('sbas.change_question')):
|
||||||
|
return HttpResponse("Forbidden")
|
||||||
|
|
||||||
# Toggle or set
|
# Toggle or set
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
|||||||
Reference in New Issue
Block a user