From 181877a70d207dbacbd337514ce8ab107a4d9734 Mon Sep 17 00:00:00 2001 From: Piotr Kopycki Date: Wed, 30 Mar 2022 23:01:39 +0200 Subject: [PATCH] Visibility property --- categories/views.py | 2 +- config/views.py | 3 ++- templates/createTest.html | 4 ++++ trials/migrations/0012_test_unvisible.py | 18 ++++++++++++++++++ .../0013_rename_unvisible_test_invisible.py | 18 ++++++++++++++++++ trials/models.py | 1 + trials/serializers.py | 1 + trials/views.py | 8 +++++++- 8 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 trials/migrations/0012_test_unvisible.py create mode 100644 trials/migrations/0013_rename_unvisible_test_invisible.py diff --git a/categories/views.py b/categories/views.py index e975457..e83be2d 100644 --- a/categories/views.py +++ b/categories/views.py @@ -16,5 +16,5 @@ class CategoryModelViewSet(viewsets.ModelViewSet): def category(request, category_name): context = {} context['name'] = category_name - context['tests'] = Test.objects.filter(category=category_name) + context['tests'] = Test.objects.filter(category=category_name, invisible=False) return render(request, 'category.html', context) \ No newline at end of file diff --git a/config/views.py b/config/views.py index aa730a6..209b7f3 100644 --- a/config/views.py +++ b/config/views.py @@ -9,7 +9,8 @@ def home(request): context = {} # TODO replace #context['tests'] = Test.objects.filter(owner=request.user) - context['tests'] = Test.objects.all + #context['tests'] = Test.objects.all + context['tests'] = Test.objects.filter(invisible=False) return render(request, 'home.html', context) diff --git a/templates/createTest.html b/templates/createTest.html index a9d0ac3..e412bd7 100644 --- a/templates/createTest.html +++ b/templates/createTest.html @@ -11,6 +11,10 @@

+ + +
+