diff --git a/anatomy/filters.py b/anatomy/filters.py
new file mode 100644
index 00000000..16c1a910
--- /dev/null
+++ b/anatomy/filters.py
@@ -0,0 +1,10 @@
+import django_filters
+
+from .models import AnatomyQuestion
+
+
+class AnatomyQuestionFilter(django_filters.FilterSet):
+ class Meta:
+ model = AnatomyQuestion
+ fields = ("question_type", "examination", "modality", "region",
+ "body_part", "created_date", "open_access", "author")
diff --git a/anatomy/static/css/anatomy.css b/anatomy/static/css/anatomy.css
index 3042477e..f148e342 100644
--- a/anatomy/static/css/anatomy.css
+++ b/anatomy/static/css/anatomy.css
@@ -91,8 +91,9 @@ button a {
color: inherit;
}
-#admin-link {
+#admin-link, #logout-link, #profile-link {
float: right;
+ padding-left: 10px;
}
.marking-list {
diff --git a/anatomy/tables.py b/anatomy/tables.py
new file mode 100644
index 00000000..b041a542
--- /dev/null
+++ b/anatomy/tables.py
@@ -0,0 +1,26 @@
+import django_tables2 as tables
+from django_tables2.utils import A
+
+from .models import AnatomyQuestion
+
+
+class AnatomyQuestionTable(tables.Table):
+ edit = tables.LinkColumn('anatomy:anatomy_question_update',
+ text='Edit',
+ args=[A('pk')],
+ orderable=False)
+ view = tables.LinkColumn('anatomy:question_detail',
+ text='View',
+ args=[A('pk')],
+ orderable=False)
+ #clone = tables.LinkColumn('anatomy:anatomy_question_clone',
+ # text='Clone',
+ # args=[A('pk')],
+ # orderable=False)
+
+ class Meta:
+ model = AnatomyQuestion
+ template_name = "django_tables2/bootstrap4.html"
+ fields = ("question_type", "description", "examination", "modality", "region",
+ "body_part", "created_date", "open_access", "author")
+ sequence = ("view", )
\ No newline at end of file
diff --git a/anatomy/templates/anatomy/anatomy_question_view.html b/anatomy/templates/anatomy/anatomy_question_view.html
new file mode 100644
index 00000000..8bcb6824
--- /dev/null
+++ b/anatomy/templates/anatomy/anatomy_question_view.html
@@ -0,0 +1,18 @@
+{% extends 'anatomy/base.html' %}
+
+{% load render_table from django_tables2 %}
+{% block css %}
+{% endblock %}
+
+{% block content %}
+
+
+
Filter Anatomy Questions
+
+
+{% render_table table %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/anatomy/templates/anatomy/base.html b/anatomy/templates/anatomy/base.html
index df687bc9..daaa6d5a 100644
--- a/anatomy/templates/anatomy/base.html
+++ b/anatomy/templates/anatomy/base.html
@@ -3,6 +3,8 @@
Anatomy Quiz
+
+
@@ -22,12 +24,24 @@
-
Exams
-
Create Question
+
Exams /
+
Questions /
+
Create Question
{% block navigation %}
{% endblock %}
diff --git a/anatomy/templates/anatomy/exam_list.html b/anatomy/templates/anatomy/exam_list.html
index 1fd7e332..dafe7db5 100644
--- a/anatomy/templates/anatomy/exam_list.html
+++ b/anatomy/templates/anatomy/exam_list.html
@@ -1,6 +1,7 @@
{% extends 'anatomy/base.html' %}
{% block content %}
+
Examinations
Active exams:
diff --git a/anatomy/templates/anatomy/exam_scores.html b/anatomy/templates/anatomy/exam_scores.html
index ddac7b3d..611c9970 100644
--- a/anatomy/templates/anatomy/exam_scores.html
+++ b/anatomy/templates/anatomy/exam_scores.html
@@ -4,7 +4,7 @@
{{ exam.name }}
{% for user, value in user_answers_marks.items %}
-
Candidate: {{ user_names|get_item:user }}
+
Answers: {% for ans, score in user_answers_and_marks|get_item:user %}
{{ans}} ({{score}}),
diff --git a/anatomy/templates/anatomy/exams.html b/anatomy/templates/anatomy/exams.html
index d86c79bc..8fb0af78 100644
--- a/anatomy/templates/anatomy/exams.html
+++ b/anatomy/templates/anatomy/exams.html
@@ -2,5 +2,5 @@
{% block navigation %}
-{{exam.name}}->
Overview Mark Scores
+{{exam.name}}->
Overview /
Mark /
Scores
{% endblock %}
\ No newline at end of file
diff --git a/anatomy/templates/anatomy/question_detail.html b/anatomy/templates/anatomy/question_detail.html
index bdddd552..9b122a45 100644
--- a/anatomy/templates/anatomy/question_detail.html
+++ b/anatomy/templates/anatomy/question_detail.html
@@ -23,7 +23,7 @@
Examinations: {% for exam in question.exams.all %}
- {{ exam.name }}
+
{{ exam.name }}
{% endfor %}
diff --git a/anatomy/urls.py b/anatomy/urls.py
index db990615..6134cf6f 100644
--- a/anatomy/urls.py
+++ b/anatomy/urls.py
@@ -6,6 +6,7 @@ app_name = "anatomy"
urlpatterns = [
# path('', views.question_list, name='question_list'),
path("", views.index, name="index"),
+ path("question/", views.AnatomyQuestionView.as_view(), name="anatomy_question_view"),
path("question/
/", views.question_detail, name="question_detail"),
path("question/create/", views.AnatomyQuestionCreate.as_view(), name="anatomy_question_create"),
path("question//update", views.AnatomyQuestionUpdate.as_view(), name="anatomy_question_update"),
diff --git a/anatomy/views.py b/anatomy/views.py
index 66a8e696..175b28b0 100644
--- a/anatomy/views.py
+++ b/anatomy/views.py
@@ -32,6 +32,12 @@ from .models import (
#IncorrectAnswers,
)
+from .tables import AnatomyQuestionTable
+from .filters import AnatomyQuestionFilter
+
+from django_tables2 import SingleTableView, SingleTableMixin
+from django_filters.views import FilterView
+
from collections import defaultdict
import os
import base64
@@ -932,4 +938,11 @@ def get_structure_id(request):
'structure_id': structure_id,
}
return HttpResponse(json.dumps(data), content_type='application/json')
- return HttpResponse("/")
\ No newline at end of file
+ return HttpResponse("/")
+
+class AnatomyQuestionView(SingleTableMixin, FilterView):
+ model = AnatomyQuestion
+ table_class = AnatomyQuestionTable
+ template_name = "anatomy/anatomy_question_view.html"
+
+ filterset_class = AnatomyQuestionFilter
\ No newline at end of file
diff --git a/rad/urls.py b/rad/urls.py
index 4b98c252..a468e734 100644
--- a/rad/urls.py
+++ b/rad/urls.py
@@ -19,12 +19,16 @@ from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import TemplateView
+
+from . import views
+
urlpatterns = [
path("admin/", admin.site.urls, name="admin"),
path("anatomy/", include("anatomy.urls"), name="anatomy"),
#path("sbas/", include("sbas.urls"), name="sbas"),
#path("rapids/", include("rapids.urls"), name="rapids"),
path("accounts/", include("django.contrib.auth.urls")),
+ path("accounts/profile", views.profile, name="profile"),
path("", TemplateView.as_view(template_name="index.html"), name="home"),
]
diff --git a/rad/views.py b/rad/views.py
new file mode 100644
index 00000000..6dc9d6d7
--- /dev/null
+++ b/rad/views.py
@@ -0,0 +1,29 @@
+from django.shortcuts import render, get_object_or_404, redirect
+from django.views.decorators.csrf import csrf_exempt
+from django import forms
+
+# from django.contrib.auth.models import User
+from django.contrib.auth.decorators import login_required, user_passes_test
+from django.contrib.auth.models import User
+
+from django.contrib.auth.mixins import LoginRequiredMixin
+
+from django.views.generic.edit import CreateView, UpdateView, DeleteView
+from django.views.generic import ListView
+
+from django.db.models.functions import Lower
+
+from django.core.cache import cache
+
+from django.urls import reverse_lazy, reverse
+
+from django.http import Http404, JsonResponse
+
+from django.http import HttpResponseRedirect, HttpResponse
+
+
+@login_required
+def profile(request):
+ user = request.user
+ return render(request, "profile.html", {"user": user})
+
diff --git a/templates/profile.html b/templates/profile.html
new file mode 100644
index 00000000..b33efced
--- /dev/null
+++ b/templates/profile.html
@@ -0,0 +1,18 @@
+{% extends 'base.html' %}
+
+{% block content %}
+
+
Your profile
+
+ Username: {{ user.username }}
+
+
+ Email: {{ user.email }}
+
+
+ Name: {{ user.first_name }}
+ {{ user.last_name }}
+
+
Change password
+
+{% endblock %}
\ No newline at end of file
diff --git a/anatomy/templates/registration/login.html b/templates/registration/login.html
similarity index 64%
rename from anatomy/templates/registration/login.html
rename to templates/registration/login.html
index f23f7ee2..636cefe0 100644
--- a/anatomy/templates/registration/login.html
+++ b/templates/registration/login.html
@@ -9,4 +9,6 @@
{{ form.as_p }}
Login
+ Reset password
+ Change password
{% endblock %}