-
-
- Diff1
-
-
- Diff2
-
- then log q then set el to `
${q}
` then log el then put el at end of #sidebar-list then
-js
-new bootstrap.Offcanvas(document.getElementById('offcanvasExample')).show();
-end
-">
- Add to sidebar
-
-
- {% endfor %}
-
+
+ Diff1
+
+
+ Diff2
+
+
+ Add to sidebar
+
+ Add codes to sidebar
+
+ Save format
+ Save format
+
+
+ {% endfor %}
+
-
Diff:
-
+
Diff:
+
{% endblock content %}
{% block css %}
-
-
+
+
{% endblock css %}
-
\ No newline at end of file
diff --git a/oef/urls.py b/oef/urls.py
index d6a23c8f..45da80ae 100644
--- a/oef/urls.py
+++ b/oef/urls.py
@@ -36,6 +36,9 @@ urlpatterns = [
path(
"entries/entries_by_question", views.entries_by_question, name="entries_by_question"
),
+ path(
+ "entries/entries_by_question/codes", views.entries_by_question_codes, name="entries_by_question_codes"
+ ),
path(
"entries//update", views.EntryUpdateView.as_view(), name="entry_update"
),
@@ -51,5 +54,8 @@ urlpatterns = [
path(
"formats//apply", views.formats_apply, name="formats_apply"
),
+ path(
+ "formats/save", views.formats_save, name="formats_save"
+ ),
]
\ No newline at end of file
diff --git a/oef/views.py b/oef/views.py
index cbe52f5c..ed22bc61 100644
--- a/oef/views.py
+++ b/oef/views.py
@@ -29,7 +29,7 @@ class FormatsCreateView(CreateView):
class FormatsUpdateView(UpdateView):
model = Formats
template_name_suffix = "_update_form"
- fields = ['name', 'format', 'inherits']
+ fields = ['name', 'format', 'specialties', 'inherits']
class EntryTableView(SingleTableMixin, FilterView):
model = Entry
@@ -96,7 +96,16 @@ def questions(request):
questions = sorted(questions, key=lambda x: len(x))
- return render(request, "oef/questions.html", {"questions": questions})
+ questions_and_formats = []
+
+ for question in questions:
+ try:
+ format = Formats.objects.get(format=question)
+ except Formats.DoesNotExist:
+ format = None
+ questions_and_formats.append((question, format))
+
+ return render(request, "oef/questions.html", {"questions": questions, "questions_and_formats": questions_and_formats})
def entries_by_question(request):
@@ -108,6 +117,16 @@ def entries_by_question(request):
return HttpResponse("Please provide a question")
+def entries_by_question_codes(request):
+
+ if request.method == "POST":
+ question = request.POST.get("question")
+ entries = Entry.objects.filter(questions=question)
+
+ return render(request, "oef/entries_by_question_codes.html", {"entries": entries})
+
+ return HttpResponse("Please provide a question")
+
def questions_diff(request):
if request.method == "POST":
question1 = request.POST.get("question1", False)
@@ -143,3 +162,26 @@ def questions_sym(request):
return HttpResponse("Please provide a question set")
+
+
+def formats_save(request):
+
+ if request.method == "POST":
+ question = request.POST.get("question")
+ format_name = request.POST.get("format_name")
+
+ if not question:
+ return HttpResponse("Please provide a question")
+
+ if Formats.objects.filter(name=format_name).exists():
+ return HttpResponse("Format name already exists")
+
+ if Formats.objects.filter(format=question).exists():
+ return HttpResponse("Format questions already exists")
+
+ Formats.objects.create(name="format_name", format=question)
+
+ return HttpResponse("Format saved")
+
+
+ return HttpResponse("Please provide a question")
\ No newline at end of file
diff --git a/physics/migrations/0015_alter_exam_markers.py b/physics/migrations/0015_alter_exam_markers.py
new file mode 100644
index 00000000..64ab0aed
--- /dev/null
+++ b/physics/migrations/0015_alter_exam_markers.py
@@ -0,0 +1,20 @@
+# Generated by Django 5.0.2 on 2024-10-09 20:39
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('physics', '0014_rename_rapid_examquestiondetail_question'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='exam',
+ name='markers',
+ field=models.ManyToManyField(blank=True, help_text='Authorised markers for the exam', related_name='physics_exam_markers', to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/rapids/migrations/0013_alter_exam_markers.py b/rapids/migrations/0013_alter_exam_markers.py
new file mode 100644
index 00000000..f9d790b0
--- /dev/null
+++ b/rapids/migrations/0013_alter_exam_markers.py
@@ -0,0 +1,20 @@
+# Generated by Django 5.0.2 on 2024-10-09 20:39
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('rapids', '0012_alter_exam_markers'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='exam',
+ name='markers',
+ field=models.ManyToManyField(blank=True, help_text='Authorised markers for the exam', related_name='rapid_exam_markers', to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/sbas/migrations/0015_alter_exam_markers.py b/sbas/migrations/0015_alter_exam_markers.py
new file mode 100644
index 00000000..7df03a9e
--- /dev/null
+++ b/sbas/migrations/0015_alter_exam_markers.py
@@ -0,0 +1,20 @@
+# Generated by Django 5.0.2 on 2024-10-09 20:39
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sbas', '0014_rename_rapid_examquestiondetail_question'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='exam',
+ name='markers',
+ field=models.ManyToManyField(blank=True, help_text='Authorised markers for the exam', related_name='sba_exam_markers', to=settings.AUTH_USER_MODEL),
+ ),
+ ]