diff --git a/astros/views.py b/astros/views.py index c5277925..67f7bff5 100644 --- a/astros/views.py +++ b/astros/views.py @@ -60,7 +60,10 @@ def all_courses(request): @login_required(login_url='astros:login') def course_enroll(request, course_id, code): # Making sure the request is done by a Student. - student = get_object_or_404(Student, pk=request.user.pk) + try: + student = get_object_or_404(Student, pk=request.user.pk) + except: + return HttpResponse(json.dumps({'state':False, 'response': 'LOGIN FIRST'})) course = get_object_or_404(Course, pk = course_id) if not Enrollment.objects.filter(student=student, course=course).exists(): # Checking whether code is valid. diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 00000000..cd4972d9 Binary files /dev/null and b/db.sqlite3 differ diff --git a/deimos/views.py b/deimos/views.py index 47b6b026..8d9d36c2 100644 --- a/deimos/views.py +++ b/deimos/views.py @@ -588,6 +588,11 @@ def register(request): username = str(username) + str(random.randint(1, 1000000)) except: pass # if profile with this username does not exists. + try: + s = Student.objects.get(username=username) + username = str(username) + str(random.randint(1, 10000000)) + except Student.DoesNotExist: + pass try: checking_student = Student.objects.get(email=email) if checking_student: diff --git a/media/20231119_195754.jpg b/media/20231119_195754.jpg new file mode 100644 index 00000000..ea588731 Binary files /dev/null and b/media/20231119_195754.jpg differ diff --git a/media/Embid.jpeg b/media/Embid.jpeg new file mode 100644 index 00000000..2b4f4a42 Binary files /dev/null and b/media/Embid.jpeg differ diff --git a/media/aii.jpg b/media/aii.jpg new file mode 100644 index 00000000..8066ae6c Binary files /dev/null and b/media/aii.jpg differ diff --git a/media/deimos/images/notes_images/20231013_171615.jpg b/media/deimos/images/notes_images/20231013_171615.jpg new file mode 100644 index 00000000..96394446 Binary files /dev/null and b/media/deimos/images/notes_images/20231013_171615.jpg differ diff --git a/media/deimos/images/notes_images/20231030_092152.jpg b/media/deimos/images/notes_images/20231030_092152.jpg new file mode 100644 index 00000000..6b252cc8 Binary files /dev/null and b/media/deimos/images/notes_images/20231030_092152.jpg differ diff --git a/media/deimos/images/notes_images/20231107_132602.jpg b/media/deimos/images/notes_images/20231107_132602.jpg new file mode 100644 index 00000000..9efad28b Binary files /dev/null and b/media/deimos/images/notes_images/20231107_132602.jpg differ diff --git a/media/deimos/images/notes_images/20231107_132602_w9r4L1Y.jpg b/media/deimos/images/notes_images/20231107_132602_w9r4L1Y.jpg new file mode 100644 index 00000000..9efad28b Binary files /dev/null and b/media/deimos/images/notes_images/20231107_132602_w9r4L1Y.jpg differ diff --git a/media/deimos/images/notes_images/2f9cb09385c40f2df2cc069b0a96b7fa.jpg b/media/deimos/images/notes_images/2f9cb09385c40f2df2cc069b0a96b7fa.jpg new file mode 100644 index 00000000..87e1d70e Binary files /dev/null and b/media/deimos/images/notes_images/2f9cb09385c40f2df2cc069b0a96b7fa.jpg differ diff --git a/media/deimos/images/notes_images/Screenshot_2023-06-21_144313.png b/media/deimos/images/notes_images/Screenshot_2023-06-21_144313.png new file mode 100644 index 00000000..8adda986 Binary files /dev/null and b/media/deimos/images/notes_images/Screenshot_2023-06-21_144313.png differ diff --git a/media/deimos/images/notes_images/download.jpeg b/media/deimos/images/notes_images/download.jpeg new file mode 100644 index 00000000..3425fec2 Binary files /dev/null and b/media/deimos/images/notes_images/download.jpeg differ diff --git a/media/deimos/images/notes_images/mcc.PNG b/media/deimos/images/notes_images/mcc.PNG new file mode 100644 index 00000000..c04a35ae Binary files /dev/null and b/media/deimos/images/notes_images/mcc.PNG differ diff --git a/media/deimos/images/notes_images/mount_fako.jpg b/media/deimos/images/notes_images/mount_fako.jpg new file mode 100644 index 00000000..01605ec5 Binary files /dev/null and b/media/deimos/images/notes_images/mount_fako.jpg differ diff --git a/media/deimos/images/notes_images/rema.jpg b/media/deimos/images/notes_images/rema.jpg new file mode 100644 index 00000000..65294c9c Binary files /dev/null and b/media/deimos/images/notes_images/rema.jpg differ diff --git a/media/embid.jpg b/media/embid.jpg new file mode 100644 index 00000000..1cae12a5 Binary files /dev/null and b/media/embid.jpg differ diff --git a/media/phobos/images/course_covers/ai.jpeg b/media/phobos/images/course_covers/ai.jpeg new file mode 100644 index 00000000..551b1b3e Binary files /dev/null and b/media/phobos/images/course_covers/ai.jpeg differ diff --git a/media/phobos/images/course_covers/download_1.jpeg b/media/phobos/images/course_covers/download_1.jpeg new file mode 100644 index 00000000..294de260 Binary files /dev/null and b/media/phobos/images/course_covers/download_1.jpeg differ diff --git a/media/phobos/images/course_covers/phys_dept_1986.jpg b/media/phobos/images/course_covers/phys_dept_1986.jpg new file mode 100644 index 00000000..0a27f94b Binary files /dev/null and b/media/phobos/images/course_covers/phys_dept_1986.jpg differ diff --git a/media/phobos/images/question_images/6147159a045bbf0a0c9b9dc7352c7b82.30.jpg b/media/phobos/images/question_images/6147159a045bbf0a0c9b9dc7352c7b82.30.jpg new file mode 100644 index 00000000..f6f444b8 Binary files /dev/null and b/media/phobos/images/question_images/6147159a045bbf0a0c9b9dc7352c7b82.30.jpg differ diff --git a/media/phobos/images/question_images/PXL_20221002_171441803.MP.jpg b/media/phobos/images/question_images/PXL_20221002_171441803.MP.jpg new file mode 100644 index 00000000..62f080cc Binary files /dev/null and b/media/phobos/images/question_images/PXL_20221002_171441803.MP.jpg differ diff --git a/media/phobos/images/question_images/ahidjo.jpg b/media/phobos/images/question_images/ahidjo.jpg new file mode 100644 index 00000000..3d3fd07e Binary files /dev/null and b/media/phobos/images/question_images/ahidjo.jpg differ diff --git a/media/phobos/images/question_images/cameroon.png b/media/phobos/images/question_images/cameroon.png new file mode 100644 index 00000000..f9d0faba Binary files /dev/null and b/media/phobos/images/question_images/cameroon.png differ diff --git a/media/phobos/images/question_images/fally_1.jpg b/media/phobos/images/question_images/fally_1.jpg new file mode 100644 index 00000000..eaf988c1 Binary files /dev/null and b/media/phobos/images/question_images/fally_1.jpg differ diff --git a/media/phobos/images/question_images/mount_fako.jpg b/media/phobos/images/question_images/mount_fako.jpg new file mode 100644 index 00000000..01605ec5 Binary files /dev/null and b/media/phobos/images/question_images/mount_fako.jpg differ diff --git a/media/phobos/images/question_images/paul.jpg b/media/phobos/images/question_images/paul.jpg new file mode 100644 index 00000000..4733a586 Binary files /dev/null and b/media/phobos/images/question_images/paul.jpg differ diff --git a/media/phobos/images/question_images/rema.jpg b/media/phobos/images/question_images/rema.jpg new file mode 100644 index 00000000..65294c9c Binary files /dev/null and b/media/phobos/images/question_images/rema.jpg differ diff --git a/media/phobos/images/question_images/salah.jpg b/media/phobos/images/question_images/salah.jpg new file mode 100644 index 00000000..290ad7bf Binary files /dev/null and b/media/phobos/images/question_images/salah.jpg differ diff --git a/media/phobos/images/question_images/wave.jfif b/media/phobos/images/question_images/wave.jfif new file mode 100644 index 00000000..23adb88c Binary files /dev/null and b/media/phobos/images/question_images/wave.jfif differ diff --git a/media/phobos/images/question_images/wizkid.jpg b/media/phobos/images/question_images/wizkid.jpg new file mode 100644 index 00000000..efcb5c2e Binary files /dev/null and b/media/phobos/images/question_images/wizkid.jpg differ diff --git a/media/zym83jwwa4e61.png b/media/zym83jwwa4e61.png new file mode 100644 index 00000000..fd0a7899 Binary files /dev/null and b/media/zym83jwwa4e61.png differ diff --git a/phobos/migrations/0050_alter_course_subject.py b/phobos/migrations/0050_alter_course_subject.py index 7ba58424..ba898ffc 100644 --- a/phobos/migrations/0050_alter_course_subject.py +++ b/phobos/migrations/0050_alter_course_subject.py @@ -1,5 +1,6 @@ # Generated by Django 4.2.3 on 2023-12-03 05:10 + from django.db import migrations, models diff --git a/run.bat b/run.bat new file mode 100644 index 00000000..72ca35a7 --- /dev/null +++ b/run.bat @@ -0,0 +1,3 @@ +python manage.py makemigrations +python manage.py migrate +python manage.py runserver 0.0.0.0:8000 \ No newline at end of file