Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
strafrecht-admin authored Oct 2, 2023
1 parent 2e16504 commit dc6dc89
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions quiz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def index(request):
header_headline = JurcoachPage.objects.all().last().header_headline
header_slogan = JurcoachPage.objects.all().last().header_slogan
return render(request, "quiz/index.html", {
"categories_grundlagen": get_categories("grundlagen"),
"categories_at": get_categories("at"),
"categories_bt": get_categories("bt"),
"header_image": header_image,
Expand Down Expand Up @@ -121,6 +122,7 @@ def quiz(request, category_id, question_id):
'category': category,
'question_version': question_version,
'questions': questions,
'categories_grundlagen': get_categories("grundlagen"),
'categories_at': get_categories("at"),
'categories_bt': get_categories("bt"),
})
Expand Down Expand Up @@ -215,12 +217,18 @@ class ChoiceViewSet(viewsets.ModelViewSet):
permission_classes = [AllowAny]

def get_category_tree(request):
grundlagen = filter(lambda x: x["category"].article.other_read, get_categories("grundlagen"))
at = filter(lambda x: x["category"].article.other_read, get_categories("at"))
bt = filter(lambda x: x["category"].article.other_read, get_categories("bt"))
tree = {
"id": "cat",
"label": "Problemfeldwiki",
"children": [
{
"id": "grundlagen",
"label": "Grundlagen",
"children": [_tree_entry(child) for child in grundlagen],
},
{
"id": "at",
"label": "Allgemeiner Teil",
Expand All @@ -231,11 +239,6 @@ def get_category_tree(request):
"label": "Besonderer Teil",
"children": [_tree_entry(child) for child in bt],
},
{
"id": "grundlagen",
"label": "Grundlagen",
"children": [_tree_entry(child) for child in grundlagen],
},
]
}

Expand Down

0 comments on commit dc6dc89

Please sign in to comment.