.
This commit is contained in:
+21
-1
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.forms.models import model_to_dict
|
||||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
@@ -738,4 +739,23 @@ class GenericViewBase:
|
||||
request,
|
||||
f"{self.app_name}/question_user_answers.html",
|
||||
{"question": question, "answers": answers},
|
||||
)
|
||||
)
|
||||
|
||||
@method_decorator(login_required)
|
||||
def author_detail(self, request, pk):
|
||||
# logging.debug(Author.objects.all())
|
||||
# author = get_object_or_404(Author, pk=pk)
|
||||
author = User.objects.get(pk=pk)
|
||||
|
||||
questions = self.question_object.objects.filter(author=pk)
|
||||
|
||||
return render(
|
||||
request, f"{self.app_name}/category_detail.html", {"category": author, "questions": questions}
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(login_required)
|
||||
def author_list(self, request):
|
||||
authors = User.objects.all()
|
||||
|
||||
return render(request, f"{self.app_name}/author_list.html", {"authors": authors})
|
||||
Reference in New Issue
Block a user