File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 5
5
app_name = 'moderation'
6
6
7
7
urlpatterns = [
8
- path ('' , views .moderation_home , name = 'moderation_home' )
8
+ path ('' , views .moderation_home , name = 'moderation_home' ),
9
+ path ('reported-questions' , views .reported_questions , name = 'reported_questions' )
9
10
]
Original file line number Diff line number Diff line change 3
3
from django .contrib .auth .decorators import login_required , user_passes_test
4
4
from django .core .exceptions import PermissionDenied
5
5
6
+ from main .models import QuestionReport
7
+
6
8
7
9
def is_moderator (user ):
8
10
"""This method is used to create a decorator that gives access to a view only
@@ -18,3 +20,12 @@ def is_moderator(user):
18
20
@user_passes_test (is_moderator )
19
21
def moderation_home (request ):
20
22
return render (request , 'moderation/moderation_home.html' )
23
+
24
+
25
+ @login_required
26
+ @user_passes_test (is_moderator )
27
+ def reported_questions (request ):
28
+ reported_question_list = QuestionReport .objects .filter (
29
+ number_of_reports__gt = 0 )
30
+
31
+ return render (request , 'moderation/reported_questions.html' , {'reported_question_list' : reported_question_list })
You can’t perform that action at this time.
0 commit comments