From 4b42b8c7e344f5a6f41caa7cff4303b74044d49a Mon Sep 17 00:00:00 2001 From: Andrew Ke Date: Sun, 5 Apr 2020 17:40:33 -0700 Subject: [PATCH 01/27] some progress --- hknweb/events/forms.py | 2 +- hknweb/exams/admin.py | 6 +- hknweb/exams/forms.py | 23 +++++++ hknweb/exams/migrations/0010_exam.py | 22 +++++++ .../migrations/0011_auto_20200405_1712.py | 26 ++++++++ .../migrations/0012_auto_20200405_1720.py | 18 ++++++ .../exams/migrations/0013_delete_semester.py | 16 +++++ .../migrations/0014_auto_20200405_1729.py | 26 ++++++++ hknweb/exams/models.py | 16 ++++- hknweb/exams/templates/exams/exams_add.html | 62 +++++++++++++++++++ hknweb/exams/urls.py | 1 + hknweb/exams/views.py | 7 ++- 12 files changed, 219 insertions(+), 6 deletions(-) create mode 100644 hknweb/exams/forms.py create mode 100644 hknweb/exams/migrations/0010_exam.py create mode 100644 hknweb/exams/migrations/0011_auto_20200405_1712.py create mode 100644 hknweb/exams/migrations/0012_auto_20200405_1720.py create mode 100644 hknweb/exams/migrations/0013_delete_semester.py create mode 100644 hknweb/exams/migrations/0014_auto_20200405_1729.py create mode 100644 hknweb/exams/templates/exams/exams_add.html diff --git a/hknweb/events/forms.py b/hknweb/events/forms.py index 298e067a..feb78b10 100644 --- a/hknweb/events/forms.py +++ b/hknweb/events/forms.py @@ -38,4 +38,4 @@ class Meta: labels = { 'slug': 'URL-friendly name', 'rsvp_limit': 'RSVP limit', - } + } \ No newline at end of file diff --git a/hknweb/exams/admin.py b/hknweb/exams/admin.py index f72d6827..0f954c01 100644 --- a/hknweb/exams/admin.py +++ b/hknweb/exams/admin.py @@ -1,7 +1,9 @@ from django.contrib import admin -from .models import Course, CourseSemester, Department, Instructor +from .models import Course, CourseSemester, Department, Instructor, Exam, Semester admin.site.register(Course) admin.site.register(CourseSemester) admin.site.register(Department) -admin.site.register(Instructor) \ No newline at end of file +admin.site.register(Instructor) +admin.site.register(Exam) +admin.site.register(Semester) \ No newline at end of file diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py new file mode 100644 index 00000000..ded3215a --- /dev/null +++ b/hknweb/exams/forms.py @@ -0,0 +1,23 @@ +from django import forms + +from hknweb.exams.models import Exam + + +class ExamUploadForm(forms.ModelForm): + + + class Meta: + model = Exam + fields = ('department', 'course') + #'markdown', 'event_type', 'view_permission', 'rsvp_type', 'transportation') + + # help_texts = { + # 'start_time': 'mm/dd/yyyy hh:mm, 24-hour time', + # 'end_time': 'mm/dd/yyyy hh:mm, 24-hour time', + # 'slug': 'e.g. -', + # } + # + # labels = { + # 'slug': 'URL-friendly name', + # 'rsvp_limit': 'RSVP limit', + # } diff --git a/hknweb/exams/migrations/0010_exam.py b/hknweb/exams/migrations/0010_exam.py new file mode 100644 index 00000000..90aa38f5 --- /dev/null +++ b/hknweb/exams/migrations/0010_exam.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:08 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0009_auto_20190421_2337_squashed_0012_auto_20191001_2145'), + ] + + operations = [ + migrations.CreateModel( + name='Exam', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='exams.Course')), + ('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Department')), + ], + ), + ] diff --git a/hknweb/exams/migrations/0011_auto_20200405_1712.py b/hknweb/exams/migrations/0011_auto_20200405_1712.py new file mode 100644 index 00000000..c79a17a4 --- /dev/null +++ b/hknweb/exams/migrations/0011_auto_20200405_1712.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:12 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0010_exam'), + ] + + operations = [ + migrations.CreateModel( + name='Semester', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('semester', models.CharField(max_length=255)), + ], + ), + migrations.AlterField( + model_name='coursesemester', + name='semester', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), + ), + ] diff --git a/hknweb/exams/migrations/0012_auto_20200405_1720.py b/hknweb/exams/migrations/0012_auto_20200405_1720.py new file mode 100644 index 00000000..ce468e96 --- /dev/null +++ b/hknweb/exams/migrations/0012_auto_20200405_1720.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0011_auto_20200405_1712'), + ] + + operations = [ + migrations.AlterField( + model_name='coursesemester', + name='semester', + field=models.CharField(max_length=255), + ), + ] diff --git a/hknweb/exams/migrations/0013_delete_semester.py b/hknweb/exams/migrations/0013_delete_semester.py new file mode 100644 index 00000000..25714730 --- /dev/null +++ b/hknweb/exams/migrations/0013_delete_semester.py @@ -0,0 +1,16 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:22 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0012_auto_20200405_1720'), + ] + + operations = [ + migrations.DeleteModel( + name='Semester', + ), + ] diff --git a/hknweb/exams/migrations/0014_auto_20200405_1729.py b/hknweb/exams/migrations/0014_auto_20200405_1729.py new file mode 100644 index 00000000..bb037c2d --- /dev/null +++ b/hknweb/exams/migrations/0014_auto_20200405_1729.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:29 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0013_delete_semester'), + ] + + operations = [ + migrations.CreateModel( + name='Semester', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('semester', models.CharField(max_length=255)), + ], + ), + migrations.AlterField( + model_name='coursesemester', + name='semester', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), + ), + ] diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index 5a6edcb3..19c2efaf 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -22,9 +22,15 @@ class Course(models.Model): def __str__(self): return "{} {}".format(self.department, self.number) +class Semester(models.Model): + semester = models.CharField(max_length=255) + + def __str__(self): + return "Test {}".format(self.semester) + class CourseSemester(models.Model): course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) - semester = models.CharField(max_length=255) + semester = models.ForeignKey(Semester, on_delete=models.CASCADE) instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE, null=False) release = models.BooleanField() midterm1 = models.FileField(blank=True) @@ -37,4 +43,10 @@ class CourseSemester(models.Model): final_sol = models.FileField(blank=True) def __str__(self): - return "CourseSemester(course={}, semester={})".format(self.course, self.semester) \ No newline at end of file + return "CourseSemester(course={}, semester={})".format(self.course, self.semester) + +# department (EE or CS), Course (Number), Instructor (Name), Exam Type(Midterm1, Midterm2, Final) +class Exam(models.Model): + department = models.ForeignKey(Department, on_delete=models.CASCADE) + course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) + diff --git a/hknweb/exams/templates/exams/exams_add.html b/hknweb/exams/templates/exams/exams_add.html new file mode 100644 index 00000000..65cf57b4 --- /dev/null +++ b/hknweb/exams/templates/exams/exams_add.html @@ -0,0 +1,62 @@ +{% extends "base.html" %} +{% load static %} +{% block title %}Add an event{% endblock %} + +{% block header %} + + + + + + + + + + + + + + + + + + + + +{% endblock %} + +{% block heading %}Upload an exam{% endblock %} + +{% block content %} +

Upload an exam

+ +
+
+ {% csrf_token %} + {% for field in form %} +
+ + {{ field.label }} + {% if field.field.required %} + * + {% endif %} + {% if field.help_text %} + ({{ field.help_text }}) + {% endif %} + + {{ field }} + {{ field.errors }} +
+ {% endfor %} +
+ + {% if messages %} + {% for message in messages %} +
+ {{ message }} + {% endfor %} + {% endif %} +
+
+
+{% endblock %} diff --git a/hknweb/exams/urls.py b/hknweb/exams/urls.py index 1aaf4606..6ac5d948 100644 --- a/hknweb/exams/urls.py +++ b/hknweb/exams/urls.py @@ -5,5 +5,6 @@ urlpatterns = [ path('course///', views.exams_for_course), + path('new', views.add_event), url(r'^$', views.index), ] \ No newline at end of file diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index 4e62d32a..e986cbc5 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -1,5 +1,6 @@ from django.shortcuts import render +from hknweb.exams.forms import ExamUploadForm from .models import Course, CourseSemester, Department, Instructor def index(request): @@ -21,4 +22,8 @@ def exams_for_course(request, department, number): 'semesters': semesters } - return render(request, 'exams/exams-course.html', context) \ No newline at end of file + return render(request, 'exams/exams-course.html', context) + + +def add_event(request): + return render(request, 'exams/exams_add.html', {'form': ExamUploadForm(None)}) \ No newline at end of file From db9edb45eec7dbb1a7901447b9b2c9c07386ac9b Mon Sep 17 00:00:00 2001 From: Andrew Ke Date: Sun, 5 Apr 2020 18:01:37 -0700 Subject: [PATCH 02/27] more stuff --- hknweb/exams/forms.py | 8 ++++++-- .../exams/migrations/0015_exam_exam_type.py | 18 +++++++++++++++++ hknweb/exams/migrations/0016_exam_semester.py | 20 +++++++++++++++++++ hknweb/exams/models.py | 2 ++ hknweb/exams/views.py | 7 +++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 hknweb/exams/migrations/0015_exam_exam_type.py create mode 100644 hknweb/exams/migrations/0016_exam_semester.py diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index ded3215a..412b5d9c 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -4,11 +4,15 @@ class ExamUploadForm(forms.ModelForm): - + file = forms.FileField(label="Exam") class Meta: model = Exam - fields = ('department', 'course') + + + + exclude = () + # fields = ('department', 'course') #'markdown', 'event_type', 'view_permission', 'rsvp_type', 'transportation') # help_texts = { diff --git a/hknweb/exams/migrations/0015_exam_exam_type.py b/hknweb/exams/migrations/0015_exam_exam_type.py new file mode 100644 index 00000000..4cb39f00 --- /dev/null +++ b/hknweb/exams/migrations/0015_exam_exam_type.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0014_auto_20200405_1729'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='exam_type', + field=models.CharField(default='Mideterm 1', max_length=255), + ), + ] diff --git a/hknweb/exams/migrations/0016_exam_semester.py b/hknweb/exams/migrations/0016_exam_semester.py new file mode 100644 index 00000000..2285335c --- /dev/null +++ b/hknweb/exams/migrations/0016_exam_semester.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2.8 on 2020-04-06 00:50 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0015_exam_exam_type'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='semester', + field=models.ForeignKey(default=False, on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), + preserve_default=False, + ), + ] diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index 19c2efaf..f92b7775 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -49,4 +49,6 @@ def __str__(self): class Exam(models.Model): department = models.ForeignKey(Department, on_delete=models.CASCADE) course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) + semester = models.ForeignKey(Semester, on_delete=models.CASCADE) + exam_type = models.CharField(max_length=255, default = "Mideterm 1") diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index e986cbc5..da058a87 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -1,3 +1,4 @@ +from django.http import HttpResponseRedirect from django.shortcuts import render from hknweb.exams.forms import ExamUploadForm @@ -26,4 +27,10 @@ def exams_for_course(request, department, number): def add_event(request): + if request.method == 'POST': + form = ExamUploadForm(request.POST, request.FILES) + if form.is_valid(): + form.save() + return HttpResponseRedirect('/') + return render(request, 'exams/exams_add.html', {'form': ExamUploadForm(None)}) \ No newline at end of file From f612c09f1265885f8c384cd5bdf5e7af4e8ed389 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Sat, 18 Apr 2020 12:53:40 -0700 Subject: [PATCH 03/27] Exam Upload (text labels only) --- Pipfile.lock | 42 ++++++++++--------- hknweb/exams/admin.py | 8 ++-- hknweb/exams/forms.py | 8 ++-- .../migrations/0017_auto_20200412_1608.py | 24 +++++++++++ .../migrations/0018_auto_20200412_1715.py | 33 +++++++++++++++ .../migrations/0019_auto_20200413_0212.py | 34 +++++++++++++++ hknweb/exams/models.py | 28 +++++++++---- hknweb/exams/templates/exams/exams_add.html | 20 +++++++++ hknweb/exams/templates/exams/index.html | 20 +++++++++ hknweb/exams/urls.py | 2 +- hknweb/exams/views.py | 8 ++-- 11 files changed, 190 insertions(+), 37 deletions(-) create mode 100644 hknweb/exams/migrations/0017_auto_20200412_1608.py create mode 100644 hknweb/exams/migrations/0018_auto_20200412_1715.py create mode 100644 hknweb/exams/migrations/0019_auto_20200413_0212.py diff --git a/Pipfile.lock b/Pipfile.lock index 9189b4a2..206429e3 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -236,9 +236,10 @@ }, "pycparser": { "hashes": [ - "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" + "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0", + "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705" ], - "version": "==2.19" + "version": "==2.20" }, "pyjwt": { "hashes": [ @@ -328,10 +329,10 @@ }, "sqlparse": { "hashes": [ - "sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", - "sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873" + "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e", + "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548" ], - "version": "==0.3.0" + "version": "==0.3.1" }, "urllib3": { "hashes": [ @@ -415,11 +416,11 @@ }, "importlib-resources": { "hashes": [ - "sha256:6e2783b2538bd5a14678284a3962b0660c715e5a0f10243fd5e00a4b5974f50b", - "sha256:d3279fd0f6f847cced9f7acc19bd3e5df54d34f93a2e7bb5f238f81545787078" + "sha256:1dff36d42d94bd523eeb847c25c7dd327cb56686d74a26dfcc8d67c504922d59", + "sha256:7f0e1b2b5f3981e39c52da0f99b2955353c5a139c314994d1126c2551ace9bdf" ], "markers": "python_version < '3.7'", - "version": "==1.0.2" + "version": "==1.3.1" }, "livereload": { "hashes": [ @@ -521,15 +522,17 @@ }, "tornado": { "hashes": [ - "sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c", - "sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60", - "sha256:4e73ef678b1a859f0cb29e1d895526a20ea64b5ffd510a2307b5998c7df24281", - "sha256:559bce3d31484b665259f50cd94c5c28b961b09315ccd838f284687245f416e5", - "sha256:abbe53a39734ef4aba061fca54e30c6b4639d3e1f59653f0da37a0003de148c7", - "sha256:c845db36ba616912074c5b1ee897f8e0124df269468f25e4fe21fe72f6edd7a9", - "sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5" + "sha256:0fe2d45ba43b00a41cd73f8be321a44936dc1aba233dee979f17a042b83eb6dc", + "sha256:22aed82c2ea340c3771e3babc5ef220272f6fd06b5108a53b4976d0d722bcd52", + "sha256:2c027eb2a393d964b22b5c154d1a23a5f8727db6fda837118a776b29e2b8ebc6", + "sha256:5217e601700f24e966ddab689f90b7ea4bd91ff3357c3600fa1045e26d68e55d", + "sha256:5618f72e947533832cbc3dec54e1dffc1747a5cb17d1fd91577ed14fa0dc081b", + "sha256:5f6a07e62e799be5d2330e68d808c8ac41d4a259b9cea61da4101b83cb5dc673", + "sha256:c58d56003daf1b616336781b26d184023ea4af13ae143d9dda65e31e534940b9", + "sha256:c952975c8ba74f546ae6de2e226ab3cc3cc11ae47baf607459a6728585bb542a", + "sha256:c98232a3ac391f5faea6821b53db8db461157baa788f5d6222a193e9456e1740" ], - "version": "==6.0.3" + "version": "==6.0.4" }, "tox": { "hashes": [ @@ -541,16 +544,17 @@ }, "virtualenv": { "hashes": [ - "sha256:30ea90b21dabd11da5f509710ad3be2ae47d40ccbc717dfdd2efe4367c10f598", - "sha256:4a36a96d785428278edd389d9c36d763c5755844beb7509279194647b1ef47f1" + "sha256:5eba85dfa176fde0425b9b3042ed83f05a1b6309a616b8a3e2a9a94f4bfa27b7", + "sha256:99f131be2f90ff2a8fd711261a27845b6c50fc008bef815e710c7fa844eb1467" ], - "version": "==20.0.7" + "version": "==20.0.9" }, "zipp": { "hashes": [ "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1", "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921" ], + "markers": "python_version < '3.8'", "version": "==1.2.0" } } diff --git a/hknweb/exams/admin.py b/hknweb/exams/admin.py index 0f954c01..359bbb93 100644 --- a/hknweb/exams/admin.py +++ b/hknweb/exams/admin.py @@ -1,9 +1,11 @@ from django.contrib import admin -from .models import Course, CourseSemester, Department, Instructor, Exam, Semester +from .models import Course, Department, Instructor, Exam, Semester, ExamChoice admin.site.register(Course) -admin.site.register(CourseSemester) +# admin.site.register(CourseSemester) admin.site.register(Department) admin.site.register(Instructor) admin.site.register(Exam) -admin.site.register(Semester) \ No newline at end of file +admin.site.register(Semester) +admin.site.register(ExamChoice) + diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index 412b5d9c..7a887a65 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -8,11 +8,8 @@ class ExamUploadForm(forms.ModelForm): class Meta: model = Exam - - - exclude = () - # fields = ('department', 'course') + fields = ('department', 'course', 'semester', 'instructor', 'exam_type', 'solution') #'markdown', 'event_type', 'view_permission', 'rsvp_type', 'transportation') # help_texts = { @@ -25,3 +22,6 @@ class Meta: # 'slug': 'URL-friendly name', # 'rsvp_limit': 'RSVP limit', # } + labels = { + 'solution': 'Exam or Solution?' + } diff --git a/hknweb/exams/migrations/0017_auto_20200412_1608.py b/hknweb/exams/migrations/0017_auto_20200412_1608.py new file mode 100644 index 00000000..636d439d --- /dev/null +++ b/hknweb/exams/migrations/0017_auto_20200412_1608.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.8 on 2020-04-12 23:08 + +from django.db import migrations, models +import hknweb.exams.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0016_exam_semester'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='instructor', + field=models.CharField(default='ProfBob', max_length=255, verbose_name=hknweb.exams.models.Instructor), + ), + migrations.AddField( + model_name='exam', + name='solution', + field=models.BooleanField(default=False), + ), + ] diff --git a/hknweb/exams/migrations/0018_auto_20200412_1715.py b/hknweb/exams/migrations/0018_auto_20200412_1715.py new file mode 100644 index 00000000..83186b48 --- /dev/null +++ b/hknweb/exams/migrations/0018_auto_20200412_1715.py @@ -0,0 +1,33 @@ +# Generated by Django 2.2.8 on 2020-04-13 00:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0017_auto_20200412_1608'), + ] + + operations = [ + migrations.RenameField( + model_name='department', + old_name='name', + new_name='abbreviated_name', + ), + migrations.RenameField( + model_name='department', + old_name='subject', + new_name='long_name', + ), + migrations.AlterField( + model_name='exam', + name='exam_type', + field=models.CharField(default='', max_length=255), + ), + migrations.AlterField( + model_name='exam', + name='instructor', + field=models.CharField(default='', max_length=255), + ), + ] diff --git a/hknweb/exams/migrations/0019_auto_20200413_0212.py b/hknweb/exams/migrations/0019_auto_20200413_0212.py new file mode 100644 index 00000000..d3e28f99 --- /dev/null +++ b/hknweb/exams/migrations/0019_auto_20200413_0212.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.8 on 2020-04-13 09:12 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0018_auto_20200412_1715'), + ] + + operations = [ + migrations.CreateModel( + name='ExamChoice', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('exam_Choice', models.CharField(max_length=50)), + ], + ), + migrations.AlterField( + model_name='exam', + name='exam_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.ExamChoice'), + ), + migrations.AlterField( + model_name='exam', + name='instructor', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Instructor'), + ), + migrations.DeleteModel( + name='CourseSemester', + ), + ] diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index f92b7775..5ae5a820 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -1,18 +1,21 @@ from django.db import models class Department(models.Model): - name = models.CharField(unique=True, max_length=4, null=True) #short form (e.g. 'EE') - subject = models.CharField(max_length=255) #long form (e.g. 'Electrical Engineering') + abbreviated_name = models.CharField(unique=True, max_length=4, null=True) #short form (e.g. 'EE') + long_name = models.CharField(max_length=255) #long form (e.g. 'Electrical Engineering') + + def getAbbrName(self): + return self.abbreviated_name def __str__(self): - return "{}".format(self.subject) + return "{} ({})".format(self.long_name, self.abbreviated_name) class Instructor(models.Model): name = models.CharField(max_length=255) department = models.ForeignKey(Department, on_delete=models.CASCADE, null=False) def __str__(self): - return "Instructor(name={}, department={})".format(self.name, self.department) + return "{}".format(self.name) #"Instructor(name={}, department={})".format(self.name, self.department) class Course(models.Model): name = models.CharField(max_length=255, null=False) @@ -20,7 +23,7 @@ class Course(models.Model): number = models.CharField(max_length=10, null=False) def __str__(self): - return "{} {}".format(self.department, self.number) + return "{} {}".format(self.department.getAbbrName(), self.number) class Semester(models.Model): semester = models.CharField(max_length=255) @@ -28,6 +31,7 @@ class Semester(models.Model): def __str__(self): return "Test {}".format(self.semester) +""" class CourseSemester(models.Model): course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) semester = models.ForeignKey(Semester, on_delete=models.CASCADE) @@ -44,11 +48,21 @@ class CourseSemester(models.Model): def __str__(self): return "CourseSemester(course={}, semester={})".format(self.course, self.semester) +""" + +class ExamChoice(models.Model): + exam_Choice = models.CharField(max_length=50) + + def __str__(self): + return "{}".format(self.examChoices) -# department (EE or CS), Course (Number), Instructor (Name), Exam Type(Midterm1, Midterm2, Final) +# department (EE, CS, or EECS), Course (Number), Instructor (Name), Exam Type(Midterm1, Midterm2, Final) class Exam(models.Model): department = models.ForeignKey(Department, on_delete=models.CASCADE) course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) semester = models.ForeignKey(Semester, on_delete=models.CASCADE) - exam_type = models.CharField(max_length=255, default = "Mideterm 1") + instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE) + exam_type = models.ForeignKey(ExamChoice, on_delete=models.CASCADE) + solution = models.BooleanField(default=False) + # FIXME - Add file container diff --git a/hknweb/exams/templates/exams/exams_add.html b/hknweb/exams/templates/exams/exams_add.html index 65cf57b4..25bb7167 100644 --- a/hknweb/exams/templates/exams/exams_add.html +++ b/hknweb/exams/templates/exams/exams_add.html @@ -23,6 +23,26 @@ + + {% endblock %} {% block heading %}Upload an exam{% endblock %} diff --git a/hknweb/exams/templates/exams/index.html b/hknweb/exams/templates/exams/index.html index 51cf2823..b21aeb49 100644 --- a/hknweb/exams/templates/exams/index.html +++ b/hknweb/exams/templates/exams/index.html @@ -45,5 +45,25 @@

Electrical Engineering

{% endif %} {% endfor %} + +

Electrical Engineering and Computer Science (EECS)

+ +
    + {% for course in courses %} + {% if course.department.name == 'EECS' %} +
  • + EECS {{ course.number }} +
  • + {% endif %} + {% endfor %} +
+ + + {% if True %} +
+ +
+ {% endif %} + {% endblock %} diff --git a/hknweb/exams/urls.py b/hknweb/exams/urls.py index 6ac5d948..d1cc04db 100644 --- a/hknweb/exams/urls.py +++ b/hknweb/exams/urls.py @@ -5,6 +5,6 @@ urlpatterns = [ path('course///', views.exams_for_course), - path('new', views.add_event), + path('new', views.add_exam), url(r'^$', views.index), ] \ No newline at end of file diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index da058a87..108d8050 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render from hknweb.exams.forms import ExamUploadForm -from .models import Course, CourseSemester, Department, Instructor +from .models import Course, Department, Instructor, Semester def index(request): courses = Course.objects.order_by('name') @@ -16,7 +16,9 @@ def index(request): def exams_for_course(request, department, number): department = Department.objects.filter(name__exact=department).get() course = Course.objects.filter(department__exact=department.id).filter(number__exact=number).get() - semesters = CourseSemester.objects.filter(course__exact=course.id) + semesters = Semester.objects.filter(semester__exact=course.id) + # CourseSemester.objects.filter(course__exact=course.id) + context = { 'course': course, @@ -26,7 +28,7 @@ def exams_for_course(request, department, number): return render(request, 'exams/exams-course.html', context) -def add_event(request): +def add_exam(request): if request.method == 'POST': form = ExamUploadForm(request.POST, request.FILES) if form.is_valid(): From 8b0591625ffe0b2fa1f50fec453d674a03f52a2e Mon Sep 17 00:00:00 2001 From: Andrew Ke Date: Sat, 18 Apr 2020 22:48:18 -0700 Subject: [PATCH 04/27] upload working --- hknweb/exams/admin.py | 6 +-- hknweb/exams/forms.py | 34 +++++++---------- .../migrations/0020_auto_20200418_2129.py | 38 +++++++++++++++++++ hknweb/exams/models.py | 29 +++++++------- hknweb/exams/templates/exams/exams_add.html | 2 +- hknweb/exams/templates/exams/index.html | 6 +-- hknweb/exams/views.py | 26 ++++++++++--- 7 files changed, 92 insertions(+), 49 deletions(-) create mode 100644 hknweb/exams/migrations/0020_auto_20200418_2129.py diff --git a/hknweb/exams/admin.py b/hknweb/exams/admin.py index 359bbb93..6cc38769 100644 --- a/hknweb/exams/admin.py +++ b/hknweb/exams/admin.py @@ -1,11 +1,9 @@ from django.contrib import admin -from .models import Course, Department, Instructor, Exam, Semester, ExamChoice +from .models import Course, Department, Instructor, Semester, CourseSemester admin.site.register(Course) -# admin.site.register(CourseSemester) +admin.site.register(CourseSemester) admin.site.register(Department) admin.site.register(Instructor) -admin.site.register(Exam) admin.site.register(Semester) -admin.site.register(ExamChoice) diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index 7a887a65..034c561f 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -1,27 +1,19 @@ from django import forms -from hknweb.exams.models import Exam +from hknweb.exams.models import * +EXAMS = [('midterm1', 'Midterm 1'), ('midterm2', 'Midterm 2'), ('final', 'Final')] +TYPES = [('sol', 'Solution'), ('exam', 'Exam')] + +class ExamUploadForm(forms.Form): + + course = forms.ModelChoiceField(queryset=Course.objects.all()) + semester = forms.ModelChoiceField(queryset=Semester.objects.all()) + exam = forms.CharField(label='Exam', widget=forms.Select(choices=EXAMS)) + type = forms.CharField(label='Type', widget=forms.Select(choices=TYPES)) -class ExamUploadForm(forms.ModelForm): file = forms.FileField(label="Exam") - class Meta: - model = Exam - exclude = () - fields = ('department', 'course', 'semester', 'instructor', 'exam_type', 'solution') - #'markdown', 'event_type', 'view_permission', 'rsvp_type', 'transportation') - - # help_texts = { - # 'start_time': 'mm/dd/yyyy hh:mm, 24-hour time', - # 'end_time': 'mm/dd/yyyy hh:mm, 24-hour time', - # 'slug': 'e.g. -', - # } - # - # labels = { - # 'slug': 'URL-friendly name', - # 'rsvp_limit': 'RSVP limit', - # } - labels = { - 'solution': 'Exam or Solution?' - } + + + diff --git a/hknweb/exams/migrations/0020_auto_20200418_2129.py b/hknweb/exams/migrations/0020_auto_20200418_2129.py new file mode 100644 index 00000000..603cdcf2 --- /dev/null +++ b/hknweb/exams/migrations/0020_auto_20200418_2129.py @@ -0,0 +1,38 @@ +# Generated by Django 2.2.8 on 2020-04-19 04:29 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('exams', '0019_auto_20200413_0212'), + ] + + operations = [ + migrations.CreateModel( + name='CourseSemester', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('release', models.BooleanField()), + ('midterm1', models.FileField(blank=True, upload_to='')), + ('midterm1_sol', models.FileField(blank=True, upload_to='')), + ('midterm2', models.FileField(blank=True, upload_to='')), + ('midterm2_sol', models.FileField(blank=True, upload_to='')), + ('midterm3', models.FileField(blank=True, upload_to='')), + ('midterm3_sol', models.FileField(blank=True, upload_to='')), + ('final', models.FileField(blank=True, upload_to='')), + ('final_sol', models.FileField(blank=True, upload_to='')), + ('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='exams.Course')), + ('instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Instructor')), + ('semester', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester')), + ], + ), + migrations.DeleteModel( + name='Exam', + ), + migrations.DeleteModel( + name='ExamChoice', + ), + ] diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index 5ae5a820..b86f3ad6 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -29,9 +29,8 @@ class Semester(models.Model): semester = models.CharField(max_length=255) def __str__(self): - return "Test {}".format(self.semester) + return "{}".format(self.semester) -""" class CourseSemester(models.Model): course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) semester = models.ForeignKey(Semester, on_delete=models.CASCADE) @@ -48,21 +47,21 @@ class CourseSemester(models.Model): def __str__(self): return "CourseSemester(course={}, semester={})".format(self.course, self.semester) -""" -class ExamChoice(models.Model): - exam_Choice = models.CharField(max_length=50) +# class ExamChoice(models.Model): +# exam_Choice = models.CharField(max_length=50) - def __str__(self): - return "{}".format(self.examChoices) +# def __str__(self): +# return "{}".format(self.examChoices) # department (EE, CS, or EECS), Course (Number), Instructor (Name), Exam Type(Midterm1, Midterm2, Final) -class Exam(models.Model): - department = models.ForeignKey(Department, on_delete=models.CASCADE) - course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) - semester = models.ForeignKey(Semester, on_delete=models.CASCADE) - instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE) - exam_type = models.ForeignKey(ExamChoice, on_delete=models.CASCADE) - solution = models.BooleanField(default=False) - # FIXME - Add file container + +# class Exam(models.Model): +# department = models.ForeignKey(Department, on_delete=models.CASCADE) +# course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) +# semester = models.ForeignKey(Semester, on_delete=models.CASCADE) +# instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE) +# exam_type = models.ForeignKey(ExamChoice, on_delete=models.CASCADE) +# solution = models.BooleanField(default=False) +# # FIXME - Add file container diff --git a/hknweb/exams/templates/exams/exams_add.html b/hknweb/exams/templates/exams/exams_add.html index 25bb7167..01a9722a 100644 --- a/hknweb/exams/templates/exams/exams_add.html +++ b/hknweb/exams/templates/exams/exams_add.html @@ -51,7 +51,7 @@

Upload an exam

-
+ {% csrf_token %} {% for field in form %}
diff --git a/hknweb/exams/templates/exams/index.html b/hknweb/exams/templates/exams/index.html index b21aeb49..154851fc 100644 --- a/hknweb/exams/templates/exams/index.html +++ b/hknweb/exams/templates/exams/index.html @@ -26,7 +26,7 @@

Computer Science

    {% for course in courses %} - {% if course.department.name == 'CS' %} + {% if course.department.abbreviated_name == 'CS' %}
  • CS {{ course.number }}
  • @@ -38,7 +38,7 @@

    Electrical Engineering

      {% for course in courses %} - {% if course.department.name == 'EE' %} + {% if course.department.abbreviated_name == 'EE' %}
    • EE {{ course.number }}
    • @@ -50,7 +50,7 @@

      Electrical Engineering and Computer Science (EECS)

        {% for course in courses %} - {% if course.department.name == 'EECS' %} + {% if course.department.abbreviated_name == 'EECS' %}
      • EECS {{ course.number }}
      • diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index 108d8050..bef2432e 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -2,7 +2,8 @@ from django.shortcuts import render from hknweb.exams.forms import ExamUploadForm -from .models import Course, Department, Instructor, Semester +from .models import Course, Department, Instructor, Semester, CourseSemester + def index(request): courses = Course.objects.order_by('name') @@ -14,11 +15,12 @@ def index(request): return render(request, 'exams/index.html', context) def exams_for_course(request, department, number): - department = Department.objects.filter(name__exact=department).get() + + department = Department.objects.filter(abbreviated_name__exact=department).get() course = Course.objects.filter(department__exact=department.id).filter(number__exact=number).get() - semesters = Semester.objects.filter(semester__exact=course.id) - # CourseSemester.objects.filter(course__exact=course.id) + semesters = CourseSemester.objects.filter(course__exact=course.id) + print(semesters) context = { 'course': course, @@ -32,7 +34,21 @@ def add_exam(request): if request.method == 'POST': form = ExamUploadForm(request.POST, request.FILES) if form.is_valid(): - form.save() + semester = form.cleaned_data['semester'] + course = form.cleaned_data['course'] + exam = form.cleaned_data['exam'] + type = form.cleaned_data['type'] + + courseSemester = CourseSemester.objects.filter(course=course, semester=semester).first() + + # print(courseSemester) + # print(exam + type) + + setattr(courseSemester, exam + ('_sol' if (type == 'sol') else ''), request.FILES['file']) + courseSemester.save() + return HttpResponseRedirect('/') + else: + print(form.errors) return render(request, 'exams/exams_add.html', {'form': ExamUploadForm(None)}) \ No newline at end of file From 3fa0202a8db56a68a187d1c3726999036e19c0c8 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Sun, 19 Apr 2020 18:58:26 -0700 Subject: [PATCH 05/27] Search Objects Made --- hknweb/exams/exam_autocomplete.py | 14 ++++++++++++++ hknweb/exams/urls.py | 6 ++++++ hknweb/exams/views.py | 1 - 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 hknweb/exams/exam_autocomplete.py diff --git a/hknweb/exams/exam_autocomplete.py b/hknweb/exams/exam_autocomplete.py new file mode 100644 index 00000000..4a421a48 --- /dev/null +++ b/hknweb/exams/exam_autocomplete.py @@ -0,0 +1,14 @@ +from dal import autocomplete + +from .models import Course, Department, Instructor, Semester, CourseSemester + + +class CourseSemesterAutocomplete(autocomplete.Select2QuerySetView): + def get_queryset(self): + return CourseSemester.objects.all() + + def get_result_label(self, item): + return str(item.semester) + " " + str(item.course) + + def get_selected_result_label(self, item): + return str(item.semester) + " " + str(item.course) diff --git a/hknweb/exams/urls.py b/hknweb/exams/urls.py index d1cc04db..3a6aa12d 100644 --- a/hknweb/exams/urls.py +++ b/hknweb/exams/urls.py @@ -1,5 +1,6 @@ from django.conf.urls import url from django.urls import path +from .exam_autocomplete import CourseSemesterAutocomplete from . import views @@ -7,4 +8,9 @@ path('course///', views.exams_for_course), path('new', views.add_exam), url(r'^$', views.index), + url( + r'^courseSemester-autocomplete/$', + CourseSemesterAutocomplete.as_view(), + name='courseSemester-autocomplete', + ) ] \ No newline at end of file diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index bef2432e..317aa5b2 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -4,7 +4,6 @@ from hknweb.exams.forms import ExamUploadForm from .models import Course, Department, Instructor, Semester, CourseSemester - def index(request): courses = Course.objects.order_by('name') From 8228e0a5b28ed76cbe4eb429cad1cbe6bef8d086 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Sun, 26 Apr 2020 16:08:37 -0700 Subject: [PATCH 06/27] hkn web changes --- Pipfile.lock | 112 +++++++++--------- hknweb/exams/migrations/0010_exam.py | 22 ---- .../migrations/0011_auto_20200405_1712.py | 26 ---- .../migrations/0012_auto_20200405_1720.py | 18 --- .../exams/migrations/0013_delete_semester.py | 16 --- .../migrations/0014_auto_20200405_1729.py | 26 ---- .../exams/migrations/0015_exam_exam_type.py | 18 --- hknweb/exams/migrations/0016_exam_semester.py | 20 ---- .../migrations/0017_auto_20200412_1608.py | 24 ---- .../migrations/0018_auto_20200412_1715.py | 33 ------ .../migrations/0019_auto_20200413_0212.py | 34 ------ .../migrations/0020_auto_20200418_2129.py | 38 ------ 12 files changed, 55 insertions(+), 332 deletions(-) delete mode 100644 hknweb/exams/migrations/0010_exam.py delete mode 100644 hknweb/exams/migrations/0011_auto_20200405_1712.py delete mode 100644 hknweb/exams/migrations/0012_auto_20200405_1720.py delete mode 100644 hknweb/exams/migrations/0013_delete_semester.py delete mode 100644 hknweb/exams/migrations/0014_auto_20200405_1729.py delete mode 100644 hknweb/exams/migrations/0015_exam_exam_type.py delete mode 100644 hknweb/exams/migrations/0016_exam_semester.py delete mode 100644 hknweb/exams/migrations/0017_auto_20200412_1608.py delete mode 100644 hknweb/exams/migrations/0018_auto_20200412_1715.py delete mode 100644 hknweb/exams/migrations/0019_auto_20200413_0212.py delete mode 100644 hknweb/exams/migrations/0020_auto_20200418_2129.py diff --git a/Pipfile.lock b/Pipfile.lock index 206429e3..b1ea5016 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -39,10 +39,10 @@ }, "certifi": { "hashes": [ - "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", - "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" + "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304", + "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519" ], - "version": "==2019.11.28" + "version": "==2020.4.5.1" }, "cffi": { "hashes": [ @@ -86,29 +86,27 @@ }, "cryptography": { "hashes": [ - "sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c", - "sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595", - "sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad", - "sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651", - "sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2", - "sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff", - "sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d", - "sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42", - "sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d", - "sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e", - "sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912", - "sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793", - "sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13", - "sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7", - "sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0", - "sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879", - "sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f", - "sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9", - "sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2", - "sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf", - "sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8" - ], - "version": "==2.8" + "sha256:091d31c42f444c6f519485ed528d8b451d1a0c7bf30e8ca583a0cac44b8a0df6", + "sha256:18452582a3c85b96014b45686af264563e3e5d99d226589f057ace56196ec78b", + "sha256:1dfa985f62b137909496e7fc182dac687206d8d089dd03eaeb28ae16eec8e7d5", + "sha256:1e4014639d3d73fbc5ceff206049c5a9a849cefd106a49fa7aaaa25cc0ce35cf", + "sha256:22e91636a51170df0ae4dcbd250d318fd28c9f491c4e50b625a49964b24fe46e", + "sha256:3b3eba865ea2754738616f87292b7f29448aec342a7c720956f8083d252bf28b", + "sha256:651448cd2e3a6bc2bb76c3663785133c40d5e1a8c1a9c5429e4354201c6024ae", + "sha256:726086c17f94747cedbee6efa77e99ae170caebeb1116353c6cf0ab67ea6829b", + "sha256:844a76bc04472e5135b909da6aed84360f522ff5dfa47f93e3dd2a0b84a89fa0", + "sha256:88c881dd5a147e08d1bdcf2315c04972381d026cdb803325c03fe2b4a8ed858b", + "sha256:96c080ae7118c10fcbe6229ab43eb8b090fccd31a09ef55f83f690d1ef619a1d", + "sha256:a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229", + "sha256:bb1f0281887d89617b4c68e8db9a2c42b9efebf2702a3c5bf70599421a8623e3", + "sha256:c447cf087cf2dbddc1add6987bbe2f767ed5317adb2d08af940db517dd704365", + "sha256:c4fd17d92e9d55b84707f4fd09992081ba872d1a0c610c109c18e062e06a2e55", + "sha256:d0d5aeaedd29be304848f1c5059074a740fa9f6f26b84c5b63e8b29e73dfc270", + "sha256:daf54a4b07d67ad437ff239c8a4080cfd1cc7213df57d33c97de7b4738048d5e", + "sha256:e993468c859d084d5579e2ebee101de8f5a27ce8e2159959b6673b418fd8c785", + "sha256:f118a95c7480f5be0df8afeb9a11bd199aa20afab7a96bcf20409b411a3a85f0" + ], + "version": "==2.9.2" }, "defusedxml": { "hashes": [ @@ -321,11 +319,11 @@ }, "social-auth-core": { "hashes": [ - "sha256:47cd2458c8fefd02466b0c514643e02ad8b61d8b4b69f7573e80882e3a97b0f0", - "sha256:8320666548a532eb158968eda542bbe1863682357c432d8c4e28034a7f1e3b58", - "sha256:d81ed681e3c0722300b61a0792c5db5d21206793f95ca810f010c1cc931c8d89" + "sha256:21c0639c56befd33ec162c2210d583bb1de8e1136d53b21bafb96afaf2f86c91", + "sha256:2f6ce1af8ec2b2cc37b86d647f7d4e4292f091ee556941db34b1e0e2dee77fc0", + "sha256:4a3cdf69c449b235cdabd54a1be7ba3722611297e69fded52e3584b1a990af25" ], - "version": "==3.2.0" + "version": "==3.3.3" }, "sqlparse": { "hashes": [ @@ -336,10 +334,10 @@ }, "urllib3": { "hashes": [ - "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc", - "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc" + "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", + "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" ], - "version": "==1.25.8" + "version": "==1.25.9" }, "whitenoise": { "hashes": [ @@ -401,26 +399,26 @@ }, "identify": { "hashes": [ - "sha256:1222b648251bdcb8deb240b294f450fbf704c7984e08baa92507e4ea10b436d5", - "sha256:d824ebe21f38325c771c41b08a95a761db1982f1fc0eee37c6c97df3f1636b96" + "sha256:23c18d97bb50e05be1a54917ee45cc61d57cb96aedc06aabb2b02331edf0dbf0", + "sha256:88ed90632023e52a6495749c6732e61e08ec9f4f04e95484a5c37b9caf40283c" ], - "version": "==1.4.11" + "version": "==1.4.15" }, "importlib-metadata": { "hashes": [ - "sha256:06f5b3a99029c7134207dd882428a66992a9de2bef7c2b699b5641f9886c3302", - "sha256:b97607a1a18a5100839aec1dc26a1ea17ee0d93b20b0f008d80a5a050afb200b" + "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f", + "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e" ], "markers": "python_version < '3.8'", - "version": "==1.5.0" + "version": "==1.6.0" }, "importlib-resources": { "hashes": [ - "sha256:1dff36d42d94bd523eeb847c25c7dd327cb56686d74a26dfcc8d67c504922d59", - "sha256:7f0e1b2b5f3981e39c52da0f99b2955353c5a139c314994d1126c2551ace9bdf" + "sha256:6f87df66833e1942667108628ec48900e02a4ab4ad850e25fbf07cb17cf734ca", + "sha256:85dc0b9b325ff78c8bef2e4ff42616094e16b98ebd5e3b50fe7e2f0bbcdcde49" ], "markers": "python_version < '3.7'", - "version": "==1.3.1" + "version": "==1.5.0" }, "livereload": { "hashes": [ @@ -492,19 +490,19 @@ }, "pyyaml": { "hashes": [ - "sha256:059b2ee3194d718896c0ad077dd8c043e5e909d9180f387ce42012662a4946d6", - "sha256:1cf708e2ac57f3aabc87405f04b86354f66799c8e62c28c5fc5f88b5521b2dbf", - "sha256:24521fa2890642614558b492b473bee0ac1f8057a7263156b02e8b14c88ce6f5", - "sha256:4fee71aa5bc6ed9d5f116327c04273e25ae31a3020386916905767ec4fc5317e", - "sha256:70024e02197337533eef7b85b068212420f950319cc8c580261963aefc75f811", - "sha256:74782fbd4d4f87ff04159e986886931456a1894c61229be9eaf4de6f6e44b99e", - "sha256:940532b111b1952befd7db542c370887a8611660d2b9becff75d39355303d82d", - "sha256:cb1f2f5e426dc9f07a7681419fe39cee823bb74f723f36f70399123f439e9b20", - "sha256:dbbb2379c19ed6042e8f11f2a2c66d39cceb8aeace421bfc29d085d93eda3689", - "sha256:e3a057b7a64f1222b56e47bcff5e4b94c4f61faac04c7c4ecb1985e18caa3994", - "sha256:e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" + "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", + "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76", + "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2", + "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648", + "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf", + "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f", + "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2", + "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee", + "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d", + "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c", + "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a" ], - "version": "==5.3" + "version": "==5.3.1" }, "six": { "hashes": [ @@ -544,10 +542,10 @@ }, "virtualenv": { "hashes": [ - "sha256:5eba85dfa176fde0425b9b3042ed83f05a1b6309a616b8a3e2a9a94f4bfa27b7", - "sha256:99f131be2f90ff2a8fd711261a27845b6c50fc008bef815e710c7fa844eb1467" + "sha256:5021396e8f03d0d002a770da90e31e61159684db2859d0ba4850fbea752aa675", + "sha256:ac53ade75ca189bc97b6c1d9ec0f1a50efe33cbf178ae09452dcd9fd309013c1" ], - "version": "==20.0.9" + "version": "==20.0.18" }, "zipp": { "hashes": [ diff --git a/hknweb/exams/migrations/0010_exam.py b/hknweb/exams/migrations/0010_exam.py deleted file mode 100644 index 90aa38f5..00000000 --- a/hknweb/exams/migrations/0010_exam.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:08 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0009_auto_20190421_2337_squashed_0012_auto_20191001_2145'), - ] - - operations = [ - migrations.CreateModel( - name='Exam', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='exams.Course')), - ('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Department')), - ], - ), - ] diff --git a/hknweb/exams/migrations/0011_auto_20200405_1712.py b/hknweb/exams/migrations/0011_auto_20200405_1712.py deleted file mode 100644 index c79a17a4..00000000 --- a/hknweb/exams/migrations/0011_auto_20200405_1712.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:12 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0010_exam'), - ] - - operations = [ - migrations.CreateModel( - name='Semester', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('semester', models.CharField(max_length=255)), - ], - ), - migrations.AlterField( - model_name='coursesemester', - name='semester', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), - ), - ] diff --git a/hknweb/exams/migrations/0012_auto_20200405_1720.py b/hknweb/exams/migrations/0012_auto_20200405_1720.py deleted file mode 100644 index ce468e96..00000000 --- a/hknweb/exams/migrations/0012_auto_20200405_1720.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:20 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0011_auto_20200405_1712'), - ] - - operations = [ - migrations.AlterField( - model_name='coursesemester', - name='semester', - field=models.CharField(max_length=255), - ), - ] diff --git a/hknweb/exams/migrations/0013_delete_semester.py b/hknweb/exams/migrations/0013_delete_semester.py deleted file mode 100644 index 25714730..00000000 --- a/hknweb/exams/migrations/0013_delete_semester.py +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:22 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0012_auto_20200405_1720'), - ] - - operations = [ - migrations.DeleteModel( - name='Semester', - ), - ] diff --git a/hknweb/exams/migrations/0014_auto_20200405_1729.py b/hknweb/exams/migrations/0014_auto_20200405_1729.py deleted file mode 100644 index bb037c2d..00000000 --- a/hknweb/exams/migrations/0014_auto_20200405_1729.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:29 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0013_delete_semester'), - ] - - operations = [ - migrations.CreateModel( - name='Semester', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('semester', models.CharField(max_length=255)), - ], - ), - migrations.AlterField( - model_name='coursesemester', - name='semester', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), - ), - ] diff --git a/hknweb/exams/migrations/0015_exam_exam_type.py b/hknweb/exams/migrations/0015_exam_exam_type.py deleted file mode 100644 index 4cb39f00..00000000 --- a/hknweb/exams/migrations/0015_exam_exam_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:49 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0014_auto_20200405_1729'), - ] - - operations = [ - migrations.AddField( - model_name='exam', - name='exam_type', - field=models.CharField(default='Mideterm 1', max_length=255), - ), - ] diff --git a/hknweb/exams/migrations/0016_exam_semester.py b/hknweb/exams/migrations/0016_exam_semester.py deleted file mode 100644 index 2285335c..00000000 --- a/hknweb/exams/migrations/0016_exam_semester.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-06 00:50 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0015_exam_exam_type'), - ] - - operations = [ - migrations.AddField( - model_name='exam', - name='semester', - field=models.ForeignKey(default=False, on_delete=django.db.models.deletion.CASCADE, to='exams.Semester'), - preserve_default=False, - ), - ] diff --git a/hknweb/exams/migrations/0017_auto_20200412_1608.py b/hknweb/exams/migrations/0017_auto_20200412_1608.py deleted file mode 100644 index 636d439d..00000000 --- a/hknweb/exams/migrations/0017_auto_20200412_1608.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-12 23:08 - -from django.db import migrations, models -import hknweb.exams.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0016_exam_semester'), - ] - - operations = [ - migrations.AddField( - model_name='exam', - name='instructor', - field=models.CharField(default='ProfBob', max_length=255, verbose_name=hknweb.exams.models.Instructor), - ), - migrations.AddField( - model_name='exam', - name='solution', - field=models.BooleanField(default=False), - ), - ] diff --git a/hknweb/exams/migrations/0018_auto_20200412_1715.py b/hknweb/exams/migrations/0018_auto_20200412_1715.py deleted file mode 100644 index 83186b48..00000000 --- a/hknweb/exams/migrations/0018_auto_20200412_1715.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-13 00:15 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0017_auto_20200412_1608'), - ] - - operations = [ - migrations.RenameField( - model_name='department', - old_name='name', - new_name='abbreviated_name', - ), - migrations.RenameField( - model_name='department', - old_name='subject', - new_name='long_name', - ), - migrations.AlterField( - model_name='exam', - name='exam_type', - field=models.CharField(default='', max_length=255), - ), - migrations.AlterField( - model_name='exam', - name='instructor', - field=models.CharField(default='', max_length=255), - ), - ] diff --git a/hknweb/exams/migrations/0019_auto_20200413_0212.py b/hknweb/exams/migrations/0019_auto_20200413_0212.py deleted file mode 100644 index d3e28f99..00000000 --- a/hknweb/exams/migrations/0019_auto_20200413_0212.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-13 09:12 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0018_auto_20200412_1715'), - ] - - operations = [ - migrations.CreateModel( - name='ExamChoice', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('exam_Choice', models.CharField(max_length=50)), - ], - ), - migrations.AlterField( - model_name='exam', - name='exam_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.ExamChoice'), - ), - migrations.AlterField( - model_name='exam', - name='instructor', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Instructor'), - ), - migrations.DeleteModel( - name='CourseSemester', - ), - ] diff --git a/hknweb/exams/migrations/0020_auto_20200418_2129.py b/hknweb/exams/migrations/0020_auto_20200418_2129.py deleted file mode 100644 index 603cdcf2..00000000 --- a/hknweb/exams/migrations/0020_auto_20200418_2129.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 2.2.8 on 2020-04-19 04:29 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('exams', '0019_auto_20200413_0212'), - ] - - operations = [ - migrations.CreateModel( - name='CourseSemester', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('release', models.BooleanField()), - ('midterm1', models.FileField(blank=True, upload_to='')), - ('midterm1_sol', models.FileField(blank=True, upload_to='')), - ('midterm2', models.FileField(blank=True, upload_to='')), - ('midterm2_sol', models.FileField(blank=True, upload_to='')), - ('midterm3', models.FileField(blank=True, upload_to='')), - ('midterm3_sol', models.FileField(blank=True, upload_to='')), - ('final', models.FileField(blank=True, upload_to='')), - ('final_sol', models.FileField(blank=True, upload_to='')), - ('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='exams.Course')), - ('instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Instructor')), - ('semester', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='exams.Semester')), - ], - ), - migrations.DeleteModel( - name='Exam', - ), - migrations.DeleteModel( - name='ExamChoice', - ), - ] From 15cfeaa84702d90f8d798800d8239672954a4fc6 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Sun, 26 Apr 2020 16:19:08 -0700 Subject: [PATCH 07/27] Pipfile changes --- Pipfile.lock | 144 +++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 73 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index b1ea5016..c6ed45a9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -39,10 +39,10 @@ }, "certifi": { "hashes": [ - "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304", - "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519" + "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", + "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" ], - "version": "==2020.4.5.1" + "version": "==2019.11.28" }, "cffi": { "hashes": [ @@ -86,27 +86,29 @@ }, "cryptography": { "hashes": [ - "sha256:091d31c42f444c6f519485ed528d8b451d1a0c7bf30e8ca583a0cac44b8a0df6", - "sha256:18452582a3c85b96014b45686af264563e3e5d99d226589f057ace56196ec78b", - "sha256:1dfa985f62b137909496e7fc182dac687206d8d089dd03eaeb28ae16eec8e7d5", - "sha256:1e4014639d3d73fbc5ceff206049c5a9a849cefd106a49fa7aaaa25cc0ce35cf", - "sha256:22e91636a51170df0ae4dcbd250d318fd28c9f491c4e50b625a49964b24fe46e", - "sha256:3b3eba865ea2754738616f87292b7f29448aec342a7c720956f8083d252bf28b", - "sha256:651448cd2e3a6bc2bb76c3663785133c40d5e1a8c1a9c5429e4354201c6024ae", - "sha256:726086c17f94747cedbee6efa77e99ae170caebeb1116353c6cf0ab67ea6829b", - "sha256:844a76bc04472e5135b909da6aed84360f522ff5dfa47f93e3dd2a0b84a89fa0", - "sha256:88c881dd5a147e08d1bdcf2315c04972381d026cdb803325c03fe2b4a8ed858b", - "sha256:96c080ae7118c10fcbe6229ab43eb8b090fccd31a09ef55f83f690d1ef619a1d", - "sha256:a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229", - "sha256:bb1f0281887d89617b4c68e8db9a2c42b9efebf2702a3c5bf70599421a8623e3", - "sha256:c447cf087cf2dbddc1add6987bbe2f767ed5317adb2d08af940db517dd704365", - "sha256:c4fd17d92e9d55b84707f4fd09992081ba872d1a0c610c109c18e062e06a2e55", - "sha256:d0d5aeaedd29be304848f1c5059074a740fa9f6f26b84c5b63e8b29e73dfc270", - "sha256:daf54a4b07d67ad437ff239c8a4080cfd1cc7213df57d33c97de7b4738048d5e", - "sha256:e993468c859d084d5579e2ebee101de8f5a27ce8e2159959b6673b418fd8c785", - "sha256:f118a95c7480f5be0df8afeb9a11bd199aa20afab7a96bcf20409b411a3a85f0" - ], - "version": "==2.9.2" + "sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c", + "sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595", + "sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad", + "sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651", + "sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2", + "sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff", + "sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d", + "sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42", + "sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d", + "sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e", + "sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912", + "sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793", + "sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13", + "sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7", + "sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0", + "sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879", + "sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f", + "sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9", + "sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2", + "sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf", + "sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8" + ], + "version": "==2.8" }, "defusedxml": { "hashes": [ @@ -234,10 +236,9 @@ }, "pycparser": { "hashes": [ - "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0", - "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705" + "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" ], - "version": "==2.20" + "version": "==2.19" }, "pyjwt": { "hashes": [ @@ -319,25 +320,25 @@ }, "social-auth-core": { "hashes": [ - "sha256:21c0639c56befd33ec162c2210d583bb1de8e1136d53b21bafb96afaf2f86c91", - "sha256:2f6ce1af8ec2b2cc37b86d647f7d4e4292f091ee556941db34b1e0e2dee77fc0", - "sha256:4a3cdf69c449b235cdabd54a1be7ba3722611297e69fded52e3584b1a990af25" + "sha256:47cd2458c8fefd02466b0c514643e02ad8b61d8b4b69f7573e80882e3a97b0f0", + "sha256:8320666548a532eb158968eda542bbe1863682357c432d8c4e28034a7f1e3b58", + "sha256:d81ed681e3c0722300b61a0792c5db5d21206793f95ca810f010c1cc931c8d89" ], - "version": "==3.3.3" + "version": "==3.2.0" }, "sqlparse": { "hashes": [ - "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e", - "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548" + "sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", + "sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873" ], - "version": "==0.3.1" + "version": "==0.3.0" }, "urllib3": { "hashes": [ - "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", - "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" + "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc", + "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc" ], - "version": "==1.25.9" + "version": "==1.25.8" }, "whitenoise": { "hashes": [ @@ -399,26 +400,26 @@ }, "identify": { "hashes": [ - "sha256:23c18d97bb50e05be1a54917ee45cc61d57cb96aedc06aabb2b02331edf0dbf0", - "sha256:88ed90632023e52a6495749c6732e61e08ec9f4f04e95484a5c37b9caf40283c" + "sha256:1222b648251bdcb8deb240b294f450fbf704c7984e08baa92507e4ea10b436d5", + "sha256:d824ebe21f38325c771c41b08a95a761db1982f1fc0eee37c6c97df3f1636b96" ], - "version": "==1.4.15" + "version": "==1.4.11" }, "importlib-metadata": { "hashes": [ - "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f", - "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e" + "sha256:06f5b3a99029c7134207dd882428a66992a9de2bef7c2b699b5641f9886c3302", + "sha256:b97607a1a18a5100839aec1dc26a1ea17ee0d93b20b0f008d80a5a050afb200b" ], "markers": "python_version < '3.8'", - "version": "==1.6.0" + "version": "==1.5.0" }, "importlib-resources": { "hashes": [ - "sha256:6f87df66833e1942667108628ec48900e02a4ab4ad850e25fbf07cb17cf734ca", - "sha256:85dc0b9b325ff78c8bef2e4ff42616094e16b98ebd5e3b50fe7e2f0bbcdcde49" + "sha256:6e2783b2538bd5a14678284a3962b0660c715e5a0f10243fd5e00a4b5974f50b", + "sha256:d3279fd0f6f847cced9f7acc19bd3e5df54d34f93a2e7bb5f238f81545787078" ], "markers": "python_version < '3.7'", - "version": "==1.5.0" + "version": "==1.0.2" }, "livereload": { "hashes": [ @@ -490,19 +491,19 @@ }, "pyyaml": { "hashes": [ - "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", - "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76", - "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2", - "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648", - "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf", - "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f", - "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2", - "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee", - "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d", - "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c", - "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a" + "sha256:059b2ee3194d718896c0ad077dd8c043e5e909d9180f387ce42012662a4946d6", + "sha256:1cf708e2ac57f3aabc87405f04b86354f66799c8e62c28c5fc5f88b5521b2dbf", + "sha256:24521fa2890642614558b492b473bee0ac1f8057a7263156b02e8b14c88ce6f5", + "sha256:4fee71aa5bc6ed9d5f116327c04273e25ae31a3020386916905767ec4fc5317e", + "sha256:70024e02197337533eef7b85b068212420f950319cc8c580261963aefc75f811", + "sha256:74782fbd4d4f87ff04159e986886931456a1894c61229be9eaf4de6f6e44b99e", + "sha256:940532b111b1952befd7db542c370887a8611660d2b9becff75d39355303d82d", + "sha256:cb1f2f5e426dc9f07a7681419fe39cee823bb74f723f36f70399123f439e9b20", + "sha256:dbbb2379c19ed6042e8f11f2a2c66d39cceb8aeace421bfc29d085d93eda3689", + "sha256:e3a057b7a64f1222b56e47bcff5e4b94c4f61faac04c7c4ecb1985e18caa3994", + "sha256:e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" ], - "version": "==5.3.1" + "version": "==5.3" }, "six": { "hashes": [ @@ -520,17 +521,15 @@ }, "tornado": { "hashes": [ - "sha256:0fe2d45ba43b00a41cd73f8be321a44936dc1aba233dee979f17a042b83eb6dc", - "sha256:22aed82c2ea340c3771e3babc5ef220272f6fd06b5108a53b4976d0d722bcd52", - "sha256:2c027eb2a393d964b22b5c154d1a23a5f8727db6fda837118a776b29e2b8ebc6", - "sha256:5217e601700f24e966ddab689f90b7ea4bd91ff3357c3600fa1045e26d68e55d", - "sha256:5618f72e947533832cbc3dec54e1dffc1747a5cb17d1fd91577ed14fa0dc081b", - "sha256:5f6a07e62e799be5d2330e68d808c8ac41d4a259b9cea61da4101b83cb5dc673", - "sha256:c58d56003daf1b616336781b26d184023ea4af13ae143d9dda65e31e534940b9", - "sha256:c952975c8ba74f546ae6de2e226ab3cc3cc11ae47baf607459a6728585bb542a", - "sha256:c98232a3ac391f5faea6821b53db8db461157baa788f5d6222a193e9456e1740" + "sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c", + "sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60", + "sha256:4e73ef678b1a859f0cb29e1d895526a20ea64b5ffd510a2307b5998c7df24281", + "sha256:559bce3d31484b665259f50cd94c5c28b961b09315ccd838f284687245f416e5", + "sha256:abbe53a39734ef4aba061fca54e30c6b4639d3e1f59653f0da37a0003de148c7", + "sha256:c845db36ba616912074c5b1ee897f8e0124df269468f25e4fe21fe72f6edd7a9", + "sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5" ], - "version": "==6.0.4" + "version": "==6.0.3" }, "tox": { "hashes": [ @@ -542,18 +541,17 @@ }, "virtualenv": { "hashes": [ - "sha256:5021396e8f03d0d002a770da90e31e61159684db2859d0ba4850fbea752aa675", - "sha256:ac53ade75ca189bc97b6c1d9ec0f1a50efe33cbf178ae09452dcd9fd309013c1" + "sha256:30ea90b21dabd11da5f509710ad3be2ae47d40ccbc717dfdd2efe4367c10f598", + "sha256:4a36a96d785428278edd389d9c36d763c5755844beb7509279194647b1ef47f1" ], - "version": "==20.0.18" + "version": "==20.0.7" }, "zipp": { "hashes": [ "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1", "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921" ], - "markers": "python_version < '3.8'", "version": "==1.2.0" } } -} +} \ No newline at end of file From 371b3c0a351ffbbd0627b3cbb8330a3c6d212c86 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Sun, 26 Apr 2020 16:23:33 -0700 Subject: [PATCH 08/27] Update Pipfile.lock w/ an Enter --- Pipfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile.lock b/Pipfile.lock index c6ed45a9..9189b4a2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -554,4 +554,4 @@ "version": "==1.2.0" } } -} \ No newline at end of file +} From c19f087ac915b344fee62c3a22f73f8a484d96e2 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Wed, 10 Jun 2020 15:32:21 -0700 Subject: [PATCH 09/27] Style Edits from Pull Request --- hknweb/exams/forms.py | 2 +- hknweb/exams/models.py | 7 ++----- hknweb/exams/urls.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index 034c561f..7d708b8b 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -3,7 +3,7 @@ from hknweb.exams.models import * EXAMS = [('midterm1', 'Midterm 1'), ('midterm2', 'Midterm 2'), ('final', 'Final')] -TYPES = [('sol', 'Solution'), ('exam', 'Exam')] +TYPES = [('exam', 'Exam'), ('sol', 'Solution')] class ExamUploadForm(forms.Form): diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index b86f3ad6..787f93f2 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -1,12 +1,9 @@ from django.db import models class Department(models.Model): - abbreviated_name = models.CharField(unique=True, max_length=4, null=True) #short form (e.g. 'EE') + abbreviated_name = models.CharField(unique=True, max_length=8, null=True) #short form (e.g. 'EE') long_name = models.CharField(max_length=255) #long form (e.g. 'Electrical Engineering') - def getAbbrName(self): - return self.abbreviated_name - def __str__(self): return "{} ({})".format(self.long_name, self.abbreviated_name) @@ -23,7 +20,7 @@ class Course(models.Model): number = models.CharField(max_length=10, null=False) def __str__(self): - return "{} {}".format(self.department.getAbbrName(), self.number) + return "{} {}".format(self.department.abbreviated_name, self.number) class Semester(models.Model): semester = models.CharField(max_length=255) diff --git a/hknweb/exams/urls.py b/hknweb/exams/urls.py index 3a6aa12d..3234ac72 100644 --- a/hknweb/exams/urls.py +++ b/hknweb/exams/urls.py @@ -6,7 +6,7 @@ urlpatterns = [ path('course///', views.exams_for_course), - path('new', views.add_exam), + path('new/', views.add_exam), url(r'^$', views.index), url( r'^courseSemester-autocomplete/$', From e1d54ee5d20be46945fb7543a035690f0f6b904c Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Thu, 11 Jun 2020 22:00:46 -0700 Subject: [PATCH 10/27] Exam Autocomplete edited with commented code --- hknweb/exams/exam_autocomplete.py | 39 +++++++++++++++++++------ hknweb/exams/forms.py | 5 +--- hknweb/exams/models.py | 18 ------------ hknweb/exams/templates/exams/index.html | 22 ++++++++++++++ hknweb/exams/urls.py | 18 ++++++------ hknweb/exams/views.py | 5 ++-- 6 files changed, 65 insertions(+), 42 deletions(-) diff --git a/hknweb/exams/exam_autocomplete.py b/hknweb/exams/exam_autocomplete.py index 4a421a48..f5fcc965 100644 --- a/hknweb/exams/exam_autocomplete.py +++ b/hknweb/exams/exam_autocomplete.py @@ -1,14 +1,35 @@ -from dal import autocomplete +# from dal import autocomplete -from .models import Course, Department, Instructor, Semester, CourseSemester +# from .models import Course, Department, Instructor, Semester, CourseSemester -class CourseSemesterAutocomplete(autocomplete.Select2QuerySetView): - def get_queryset(self): - return CourseSemester.objects.all() +# class CourseSemesterAutocomplete(autocomplete.Select2QuerySetView): +# def get_queryset(self): +# allQs = CourseSemester.objects.all() +# if self.q: +# qs = allQs +# searchTerms = self.q.split(" ") +# checkedIndexes = set() +# def lookup(qs, filterAction): +# for i in range(len(searchTerms)): +# if i in checkedIndexes: +# continue +# term = searchTerms[i] +# filteredQs = filterAction(qs, term) +# if filteredQs: +# qs = filteredQs +# checkedIndexes.add(i) +# return qs +# qs = lookup(qs, lambda qs, term: qs.filter(semester__semester__contains=term)) +# qs = lookup(qs, lambda qs, term: qs.filter(course__department__abbreviated_name__contains=term)) +# qs = lookup(qs, lambda qs, term: qs.filter(course__number__contains=term)) +# if len(checkedIndexes) == 0: +# return CourseSemester.objects.none() +# return qs +# return allQs - def get_result_label(self, item): - return str(item.semester) + " " + str(item.course) +# def get_result_label(self, item): +# return str(item.semester) + " " + str(item.course) - def get_selected_result_label(self, item): - return str(item.semester) + " " + str(item.course) +# def get_selected_result_label(self, item): +# return str(item.semester) + " " + str(item.course) diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index 7d708b8b..5cb255d1 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -1,4 +1,5 @@ from django import forms +from dal import autocomplete from hknweb.exams.models import * @@ -13,7 +14,3 @@ class ExamUploadForm(forms.Form): type = forms.CharField(label='Type', widget=forms.Select(choices=TYPES)) file = forms.FileField(label="Exam") - - - - diff --git a/hknweb/exams/models.py b/hknweb/exams/models.py index 787f93f2..d146b8a8 100644 --- a/hknweb/exams/models.py +++ b/hknweb/exams/models.py @@ -44,21 +44,3 @@ class CourseSemester(models.Model): def __str__(self): return "CourseSemester(course={}, semester={})".format(self.course, self.semester) - -# class ExamChoice(models.Model): -# exam_Choice = models.CharField(max_length=50) - -# def __str__(self): -# return "{}".format(self.examChoices) - -# department (EE, CS, or EECS), Course (Number), Instructor (Name), Exam Type(Midterm1, Midterm2, Final) - -# class Exam(models.Model): -# department = models.ForeignKey(Department, on_delete=models.CASCADE) -# course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) -# semester = models.ForeignKey(Semester, on_delete=models.CASCADE) -# instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE) -# exam_type = models.ForeignKey(ExamChoice, on_delete=models.CASCADE) -# solution = models.BooleanField(default=False) -# # FIXME - Add file container - diff --git a/hknweb/exams/templates/exams/index.html b/hknweb/exams/templates/exams/index.html index 154851fc..94c4444f 100644 --- a/hknweb/exams/templates/exams/index.html +++ b/hknweb/exams/templates/exams/index.html @@ -3,6 +3,19 @@ {% block title %}Exam archive{% endblock %} {% block header %} + + + + {% endblock %} -{% block heading %}{{ course.department.subject }} {{ course.number }} Exams{% endblock %} +{% block heading %}{{ course.department.subject }} {{ course.number }} Exams{% if selectedTerm|length > 0 %} ({{ selectedTerm }}){% endif %}{% endblock %} {% block content %} diff --git a/hknweb/exams/templates/exams/index.html b/hknweb/exams/templates/exams/index.html index 94c4444f..d08374a2 100644 --- a/hknweb/exams/templates/exams/index.html +++ b/hknweb/exams/templates/exams/index.html @@ -38,7 +38,7 @@ @@ -81,7 +81,7 @@

        Electrical Engineering and Computer Science (EECS)

        - {% if True %} + {% if False %} diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index baee8e13..ffb71e1f 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -16,15 +16,25 @@ def index(request): def exams_for_course(request, department, number): + specificSemester = request.GET.get('term', '') + department = Department.objects.filter(abbreviated_name__exact=department).get() course = Course.objects.filter(department__exact=department.id).filter(number__exact=number).get() semesters = CourseSemester.objects.filter(course__exact=course.id) + + if specificSemester: + subSemesters = semesters.filter(semester__semester__exact=specificSemester) + if subSemesters: + semesters = subSemesters + else: + specificSemester = "" # print(semesters) context = { 'course': course, - 'semesters': semesters + 'semesters': semesters, + 'selectedTerm': specificSemester } return render(request, 'exams/exams-course.html', context) From e8fa044e7b09a7b2cb466850f21f94d37fc70d18 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Thu, 11 Jun 2020 23:40:22 -0700 Subject: [PATCH 13/27] Used get instead of filter and get in department Exams --- hknweb/exams/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index ffb71e1f..efdac6e8 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -18,7 +18,7 @@ def exams_for_course(request, department, number): specificSemester = request.GET.get('term', '') - department = Department.objects.filter(abbreviated_name__exact=department).get() + department = Department.objects.get(abbreviated_name=department) course = Course.objects.filter(department__exact=department.id).filter(number__exact=number).get() semesters = CourseSemester.objects.filter(course__exact=course.id) From 2b52bec706b0fa6296c610f21d46db30b030c758 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Thu, 11 Jun 2020 23:47:35 -0700 Subject: [PATCH 14/27] Used get instead of filter and get in department and course Exams --- hknweb/exams/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hknweb/exams/views.py b/hknweb/exams/views.py index efdac6e8..54d1baad 100644 --- a/hknweb/exams/views.py +++ b/hknweb/exams/views.py @@ -19,7 +19,7 @@ def exams_for_course(request, department, number): specificSemester = request.GET.get('term', '') department = Department.objects.get(abbreviated_name=department) - course = Course.objects.filter(department__exact=department.id).filter(number__exact=number).get() + course = Course.objects.filter(department__exact=department.id).get(number__exact=number) semesters = CourseSemester.objects.filter(course__exact=course.id) if specificSemester: From c679f038352365af79f9c6cb268fa20a83bbf883 Mon Sep 17 00:00:00 2001 From: Oscar Chan Date: Fri, 12 Jun 2020 00:00:57 -0700 Subject: [PATCH 15/27] Style Check fix --- hknweb/exams/forms.py | 3 +-- hknweb/exams/templates/exams/exams_add.html | 20 -------------------- hknweb/exams/urls.py | 3 +-- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/hknweb/exams/forms.py b/hknweb/exams/forms.py index 5cb255d1..6d10fd28 100644 --- a/hknweb/exams/forms.py +++ b/hknweb/exams/forms.py @@ -1,7 +1,6 @@ from django import forms -from dal import autocomplete -from hknweb.exams.models import * +from hknweb.exams.models import Course, Semester EXAMS = [('midterm1', 'Midterm 1'), ('midterm2', 'Midterm 2'), ('final', 'Final')] TYPES = [('exam', 'Exam'), ('sol', 'Solution')] diff --git a/hknweb/exams/templates/exams/exams_add.html b/hknweb/exams/templates/exams/exams_add.html index 01a9722a..fd1bc4a3 100644 --- a/hknweb/exams/templates/exams/exams_add.html +++ b/hknweb/exams/templates/exams/exams_add.html @@ -3,26 +3,6 @@ {% block title %}Add an event{% endblock %} {% block header %} - - - - - - - - - - - - - - - - - - - -