From 178ec034a3b40f2e55741f3757c9a1709ada55bf Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 23 Dec 2024 10:36:03 +0000 Subject: [PATCH] more bootstrap nav convresion --- anatomy/templates/anatomy/base.html | 45 ++++++--- ...{question_list.html => question_view.html} | 0 anatomy/urls.py | 11 +-- anatomy/views.py | 6 +- generic/urls.py | 1 - longs/models.py | 2 +- longs/templates/longs/base.html | 97 +++++++++++++------ longs/templates/longs/longseries_form.html | 1 - longs/urls.py | 14 +-- longs/views.py | 4 +- physics/templates/physics/base.html | 43 ++++++-- ...{question_list.html => question_view.html} | 0 rad/urls.py | 19 ---- rapids/models.py | 2 +- rapids/templates/rapids/base.html | 44 ++++++--- rapids/templates/rapids/exams.html | 2 +- rapids/templates/rapids/rapid_form.html | 1 - rapids/urls.py | 12 +-- rapids/views.py | 2 +- requirements.txt | 1 - sbas/views.py | 8 +- 21 files changed, 189 insertions(+), 126 deletions(-) rename anatomy/templates/anatomy/{question_list.html => question_view.html} (100%) rename physics/templates/physics/{question_list.html => question_view.html} (100%) diff --git a/anatomy/templates/anatomy/base.html b/anatomy/templates/anatomy/base.html index 9be5603e..d9ae5560 100644 --- a/anatomy/templates/anatomy/base.html +++ b/anatomy/templates/anatomy/base.html @@ -5,17 +5,40 @@ {% endblock %} {% block navigation %} - Anatomy: - {% if request.user.is_authenticated %} - Packets / - Exams / - Create Exam / - Questions / - Create Question - {% if request.user.is_superuser %} - / Answers - {% endif %} - {% endif %} + + {% endblock %} {% block content %} {% if simple_content %} diff --git a/anatomy/templates/anatomy/question_list.html b/anatomy/templates/anatomy/question_view.html similarity index 100% rename from anatomy/templates/anatomy/question_list.html rename to anatomy/templates/anatomy/question_view.html diff --git a/anatomy/urls.py b/anatomy/urls.py index 63ab6f93..a38048b8 100644 --- a/anatomy/urls.py +++ b/anatomy/urls.py @@ -7,21 +7,16 @@ from django.views.decorators.cache import cache_page app_name = "anatomy" urlpatterns = [ - # path('', views.question_list, name='question_list'), + # path('', views.question_view, name='question_view'), path( "question/", views.AnatomyQuestionView.as_view(), - name="question_list", + name="question_view", ), path( "question/create/", views.AnatomyQuestionCreate.as_view(), - name="anatomy_question_create", - ), - path( - "create/exam/", - views.AnatomyQuestionCreate.as_view(), - name="anatomy_create_exam", + name="question_create", ), path( "question//update", diff --git a/anatomy/views.py b/anatomy/views.py index ee9c660b..42ac52c5 100644 --- a/anatomy/views.py +++ b/anatomy/views.py @@ -109,14 +109,14 @@ def user_is_admin(user): return False -def question_list(request): +def question_view(request): questions = AnatomyQuestion.objects.all() if not request.user.groups.filter(name="anatomy_checker").exists(): questions = questions.filter(open_access=False) # raise PermissionDenied() - return render(request, "anatomy/question_list.html", {"questions": questions}) + return render(request, "anatomy/question_view.html", {"questions": questions}) @login_required @@ -794,7 +794,7 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView): class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView): model = AnatomyQuestion - success_url = reverse_lazy("anatomy:question_list") + success_url = reverse_lazy("anatomy:question_view") class ExamCreate(ExamCreateBase): diff --git a/generic/urls.py b/generic/urls.py index c57f14f2..5e887bc9 100755 --- a/generic/urls.py +++ b/generic/urls.py @@ -8,7 +8,6 @@ from generic.views import ExamViews as GenericExamViews, GenericViewBase app_name = "generic" urlpatterns = [ - # path('', views.question_list, name='question_list'), path("examination/", views.ExaminationView.as_view(), name="examination_view"), path("examination/", views.examination_detail, name="examination_detail"), path( diff --git a/longs/models.py b/longs/models.py index c7281ce2..81dea8dd 100644 --- a/longs/models.py +++ b/longs/models.py @@ -417,7 +417,7 @@ class LongCreationDefault(models.Model): # help_text="Default site to use when creating a new long") def get_absolute_url(self): - return reverse("longs:long_create") + return reverse("longs:question_create") class ExamQuestionDetail(models.Model): sort_order = models.IntegerField(default=1000) diff --git a/longs/templates/longs/base.html b/longs/templates/longs/base.html index aa0db0fa..acd58998 100755 --- a/longs/templates/longs/base.html +++ b/longs/templates/longs/base.html @@ -1,33 +1,66 @@ -{% extends 'base.html' %} - -{% block title %} -Longs -{% endblock %} - -{% block css %} -{% endblock %} - -{% block js %} -{% endblock %} - - - -{% block content %} -{% endblock %} -{% block navigation %} -Longs: -{% if request.user.is_authenticated %} -Exams / -Create Exam / -Cases / -Series / -Create Case / -Create Series -{% endif %} -{% if request.user.is_superuser %} - / Answers -{% endif %} -{% comment %}
-Questions by: -author {% endcomment %} +{% extends 'base.html' %} + +{% block title %} + Longs +{% endblock %} + +{% block css %} +{% endblock %} + +{% block js %} +{% endblock %} + + + +{% block content %} +{% endblock %} +{% block navigation %} + + Longs: + {% if request.user.is_authenticated %} + Exams / + Create Exam / + Cases / + Series / + Create Case / + {% endif %} + {% if request.user.is_superuser %} + / Answers + {% endif %} +{% comment %}
+Questions by: +author {% endcomment %} {% endblock %} \ No newline at end of file diff --git a/longs/templates/longs/longseries_form.html b/longs/templates/longs/longseries_form.html index 9aab61a5..f843c29f 100755 --- a/longs/templates/longs/longseries_form.html +++ b/longs/templates/longs/longseries_form.html @@ -318,7 +318,6 @@ {% endblock %} {% block content %}

Series Form

- This form will create a image set that can be associated with a long question. If the question has already been created it can be linked below.
{% csrf_token %} diff --git a/longs/urls.py b/longs/urls.py index 2ac4cc0f..d1419c27 100755 --- a/longs/urls.py +++ b/longs/urls.py @@ -6,11 +6,10 @@ from . import views app_name = "longs" urlpatterns = [ - # path('', views.question_list, name='question_list'), path("author//", views.author_detail, name="author_detail"), path("author/", views.author_list, name="author_list"), - path("question/", views.LongView.as_view(), name="long_view"), - path("series/", views.LongSeriesView.as_view(), name="long_series_view"), + path("question/", views.LongView.as_view(), name="question_view"), + path("series/", views.LongSeriesView.as_view(), name="series_view"), path("series/", views.series_detail, name="series_detail"), path( "series//order_dicom", @@ -100,18 +99,13 @@ urlpatterns = [ path("exam//clone", views.ExamClone.as_view(), name="exam_clone"), path("exam//update", views.ExamUpdate.as_view(), name="exam_update"), path("exam//delete", views.ExamDelete.as_view(), name="exam_delete"), - path("create/", views.LongCreate.as_view(), name="long_create"), - path("create/series", views.LongSeriesCreate.as_view(), name="long_series_create"), + path("create/", views.LongCreate.as_view(), name="question_create"), + path("create/series", views.LongSeriesCreate.as_view(), name="series_create"), path( "create/series/", views.LongSeriesCreate.as_view(), name="long_series_id_create", ), - path( - "create/defaults", - views.LongCreationDefaultView.as_view(), - name="long_create_defaults", - ), # path("region/create/", views.create_region, name="create_region"), # path("region/ajax/get_region_id", views.get_region_id, name="get_region_id"), # path("abnormality/create/", views.create_abnormality, name="create_abnormality"), diff --git a/longs/views.py b/longs/views.py index 73064f1d..6adecd23 100755 --- a/longs/views.py +++ b/longs/views.py @@ -273,12 +273,12 @@ class LongCreationDefaultView(LoginRequiredMixin, UpdateView): class LongDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Long - success_url = reverse_lazy("longs:long_view") + success_url = reverse_lazy("longs:question_view") class LongSeriesDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = LongSeries - success_url = reverse_lazy("longs:long_series_view") + success_url = reverse_lazy("longs:series_view") @login_required diff --git a/physics/templates/physics/base.html b/physics/templates/physics/base.html index e978bcf1..2d75aa8d 100644 --- a/physics/templates/physics/base.html +++ b/physics/templates/physics/base.html @@ -1,18 +1,43 @@ {% extends 'base.html' %} {% block title %} -Physics + Physics {% endblock %} {% block navigation %} -Physics: - {% if request.user.is_authenticated %} - Exams / - Questions - {% if request.user.is_superuser %} - / Answers - {% endif %} - {% endif %} + {% endblock %} {% block content %} {% endblock %} \ No newline at end of file diff --git a/physics/templates/physics/question_list.html b/physics/templates/physics/question_view.html similarity index 100% rename from physics/templates/physics/question_list.html rename to physics/templates/physics/question_view.html diff --git a/rad/urls.py b/rad/urls.py index bdd4cc6b..fe126951 100644 --- a/rad/urls.py +++ b/rad/urls.py @@ -31,30 +31,12 @@ from longs import views as long_views from generic import views as generic_views -from rest_framework import routers - from django.conf.urls import handler400, handler403, handler404, handler500 from .api import api from autocomplete import HTMXAutoComplete -router_drf = routers.DefaultRouter() -#router_drf.register(r"rapids/exams", rapid_views.ExamViewSet, basename="rapid-exam") -#router_drf.register(r"anatomy/exams", anatomy_views.ExamViewSet, basename="anatomy-exam") -#router_drf.register(r"longs/exams", long_views.ExamViewSet, basename="long-exam") -#router_drf.register( -# r"rapids/answers", -# rapid_views.QuestionAnswerViewSet, -# basename="rapid-question-answers", -#) -#router_drf.register( -# r"rapids/user_answer", -# rapid_views.UserAnswerViewSet, -# basename="rapid-question-answers", -#) -#router_drf.register(r"rapids", rapid_views.RapidViewSet, basename="rapid") - urlpatterns = [ path("admin/", admin.site.urls, name="admin"), path("api/", api.urls), @@ -164,7 +146,6 @@ urlpatterns = [ name="answer_suggestion_confirm", ), path("feedback/view", views.view_feedback, name="view_feedback"), - #path("api/", include(router_drf.urls)), #path("api-auth/", include("rest_framework.urls")), path("tinymce/", include("tinymce.urls")), path("cookies/", include("cookie_consent.urls")), diff --git a/rapids/models.py b/rapids/models.py index 0e1d0ee5..02755dbf 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -605,7 +605,7 @@ class RapidCreationDefault(models.Model): # help_text="Default site to use when creating a new rapid") def get_absolute_url(self): - return reverse("rapids:rapid_create") + return reverse("rapids:question_create") class ExamQuestionDetail(models.Model): exam = models.ForeignKey("Exam", on_delete=models.CASCADE) diff --git a/rapids/templates/rapids/base.html b/rapids/templates/rapids/base.html index 20974aa9..54e22cc8 100755 --- a/rapids/templates/rapids/base.html +++ b/rapids/templates/rapids/base.html @@ -18,17 +18,39 @@ {% endif %} {% endblock %} {% block navigation %} - Rapids: - {% if request.user.is_authenticated %} - Packets / - Exams / - Create Exam / - Questions / - Create Question - {% endif %} - {% if request.user.is_superuser %} - / Answers - {% endif %} + {% comment %}
Questions by: author {% endcomment %} diff --git a/rapids/templates/rapids/exams.html b/rapids/templates/rapids/exams.html index 4be5bd67..b4b994ab 100644 --- a/rapids/templates/rapids/exams.html +++ b/rapids/templates/rapids/exams.html @@ -11,5 +11,5 @@ Candidates / Stats / {% endif %} - Add New Question + Add New Question {% endblock %} diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index df19a973..c0927220 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -319,7 +319,6 @@ {% endif %}

Submit Rapid

-{% comment %} Edit defaults {% endcomment %}

Instructions

Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). String diff --git a/rapids/urls.py b/rapids/urls.py index 3ec59b4c..6617371f 100755 --- a/rapids/urls.py +++ b/rapids/urls.py @@ -11,11 +11,10 @@ app_name = "rapids" urlpatterns = [ - # path('', views.question_list, name='question_list'), #path("", views.GenericExamViews.index, name="index"), #path("exam", generic_exam_urls(views.GenericExamViews), name="index"), path("question_viewer", views.question_viewer, name="question_viewer"), - path("question/", views.RapidView.as_view(), name="rapid_view"), + path("question/", views.RapidView.as_view(), name="question_view"), path("question/hash", views.get_question_by_hash, name="rapid_question_by_hash"), # path("unchecked/", views.unchecked_list, name="unchecked_list"), # path("verified//", views.verified_detail, name="verified_detail"), @@ -64,13 +63,8 @@ urlpatterns = [ path("exam//clone", views.ExamClone.as_view(), name="exam_clone"), path("exam//update", views.ExamUpdate.as_view(), name="exam_update"), path("exam//delete", views.ExamDelete.as_view(), name="exam_delete"), - path("create/", views.RapidCreate.as_view(), name="rapid_create"), - path("create/exam/", views.RapidCreate.as_view(), name="rapid_create_exam"), - path( - "create/defaults", - views.RapidCreationDefaultView.as_view(), - name="rapid_create_defaults", - ), + path("create/", views.RapidCreate.as_view(), name="question_create"), + path("create/exam/", views.RapidCreate.as_view(), name="question_create_exam"), path("region/create/", views.create_region, name="create_region"), path("region/ajax/get_region_id", views.get_region_id, name="get_region_id"), path("abnormality/create/", views.create_abnormality, name="create_abnormality"), diff --git a/rapids/views.py b/rapids/views.py index 2368b1f2..264111de 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -733,7 +733,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False): class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView): model = Rapid - success_url = reverse_lazy("rapids:rapid_view") + success_url = reverse_lazy("rapids:question_view") GenericExamViews = ExamViews( diff --git a/requirements.txt b/requirements.txt index 6d559bad..b325395d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ pydicom django-dbbackup #django-hashedfilenamestorage git+https://github.com/allysonbarros/django-hashedfilenamestorage#egg=django-hashedfilenamestorage -djangorestframework django-tinymce django-zipview pymemcache diff --git a/sbas/views.py b/sbas/views.py index f7246e07..6a76e449 100644 --- a/sbas/views.py +++ b/sbas/views.py @@ -80,9 +80,9 @@ class AuthorOrCheckerRequiredMixin(object): return obj -def question_list(request): - questions = Question.objects.all() - return render(request, "sbas/question_list.html", {"questions": questions}) +# def question_view(request): +# questions = Question.objects.all() +# return render(request, "sbas/question_view.html", {"questions": questions}) @login_required @@ -383,7 +383,7 @@ GenericViews = GenericViewBase("sbas", Question, UserAnswer, Exam) class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView): model = Question - success_url = reverse_lazy("sbas:question_list") + success_url = reverse_lazy("sbas:question_view") class ExamCreate(ExamCreateBase):