Browse Source

everything is updated

dmr1725 3 years ago
parent
commit
46d4dd1b91

BIN
server/CompanionApp/__pycache__/admin.cpython-38.pyc View File


BIN
server/CompanionApp/__pycache__/models.cpython-38.pyc View File


BIN
server/CompanionApp/__pycache__/urls.cpython-38.pyc View File


BIN
server/CompanionApp/__pycache__/views.cpython-38.pyc View File


BIN
server/CompanionApp/migrations/__pycache__/0011_auto_20201207_0948.cpython-38.pyc View File


BIN
server/CompanionApp/migrations/__pycache__/0012_proxiosemestre.cpython-38.pyc View File


BIN
server/CompanionApp/migrations/__pycache__/0013_auto_20201207_1056.cpython-38.pyc View File


BIN
server/CompanionApp/migrations/__pycache__/0014_auto_20201207_1613.cpython-38.pyc View File


BIN
server/CompanionApp/migrations/__pycache__/0015_auto_20201208_1214.cpython-38.pyc View File


+ 8
- 1
server/CompanionApp/urls.py View File

@@ -20,6 +20,13 @@ urlpatterns = [
20 20
     url('api/get_all_courses_user_has_taken', views.getAllCoursesUserHasTaken),
21 21
     url('api/get_all_courses_by_semester', views.getAllCoursesBySemester),
22 22
     url('api/see_gpa', views.seeGPA),
23
-    url('api/insertar_prox_sem_cursos', views.insertarTodosLosCursosProxSemestre)
23
+    url('api/insertar_prox_sem_cursos', views.insertarTodosLosCursosProxSemestre),
24
+    url('api/matricular_prox_semestre', views.matricularProxSemestre),
25
+    url('api/get_current_courses', views.getMyCurrentCourses),
26
+    url('api/update_grade_and_gpa', views.updateGradeAndGPA),
27
+    url('api/delete_course', views.deleteCourse),
28
+    url('api/get_year_and_semester', views.getSemesterAndYear),
29
+    url('api/update_year_and_semester', views.updateSemesterAndYear)
30
+
24 31
 ]
25 32
 

+ 320
- 11
server/CompanionApp/views.py View File

@@ -8,6 +8,8 @@ from organizar import files3, proxSemFiles
8 8
 
9 9
 from rest_auth.registration.views import SocialLoginView
10 10
 from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
11
+from allauth.account.views import LogoutView
12
+
11 13
 
12 14
 from django.db import connection
13 15
 
@@ -27,6 +29,7 @@ from rest_framework.decorators import api_view
27 29
 class GoogleLogin(SocialLoginView):
28 30
     adapter_class = GoogleOAuth2Adapter
29 31
 
32
+
30 33
 @api_view(['POST',])
31 34
 def insertarFacultades(request):
32 35
     faculties = [ 'Administración de Empresas', 'Administración de Empresas graduado', 'Arquitectura', 'Arquitectura Graduado', 'Asuntos Académicos',
@@ -72,7 +75,7 @@ def insertarTodosLosCursos(request):
72 75
                             else:
73 76
                                 print('ya se creo del lab', i)
74 77
                                 i += 1
75
-                        elif 'LAB in key' and (name != 'LABORATORIO' or name != 'LABORATORIO ' or name != 'TALLER' or name != 'TALLER ' or name != 'CONFERENCIA' or name != 'CONFERENCIA '):
78
+                        elif 'LAB' in key and (name != 'LABORATORIO' or name != 'LABORATORIO ' or name != 'TALLER' or name != 'TALLER ' or name != 'CONFERENCIA' or name != 'CONFERENCIA '):
76 79
                             continue
77 80
                         
78 81
                         # todas las otras clases que no tengan _LAB en su codigo
@@ -117,21 +120,28 @@ def insertarTodosLosCursosProxSemestre(request):
117 120
 
118 121
                     # if course does not exist in table Curso, create the course in table Course and create the course in table ProximoSemestre
119 122
                     if course_id == None:
123
+                        print('hola')
120 124
                         # create course
121 125
                         cursor = connection.cursor()
122 126
                         cursor.execute(f'INSERT INTO "CompanionApp_curso" (name, code, creditos, fac_id_id) VALUES (\'{name}\', \'{code}\', {creditos}, {fac_id})')
123 127
                         
124
-                         # seeing again if course from json file already exists in table Curso to fetch course_id
128
+                         # once created the course, fetch the course_id
125 129
                         cursor = connection.cursor()
126 130
                         cursor.execute(f'SELECT id from "CompanionApp_curso" where code = \'{code}\'')
127 131
                         course_id = cursor.fetchone()
128
-                       
129
-                  
130
-                    # insert course to the table ProxSemestre
132
+                    
133
+                    # getting course_id from line 128 or 116
131 134
                     course_id = course_id[0]
135
+
136
+                    # before inserting course, check if that course with section is already in the table ProximoSemestre
132 137
                     cursor = connection.cursor()
133
-            
134
-                    cursor.execute(f'INSERT INTO "CompanionApp_proximosemestre" (name, code, creditos, section, prof, hours, days, rooms, course_id_id) VALUES (\'{name}\', \'{code}\', {creditos}, \'{section}\', \'{prof}\', \'{hours}\', \'{days}\', \'{rooms}\', {course_id})')
138
+                    cursor.execute(f'Select id from "CompanionApp_proximosemestre" where code=\'{code}\' and section=\'{section}\'')
139
+                    prox_sem_id = cursor.fetchone() # id from table 
140
+    
141
+                    # if course with section does not exist, insert it in the table ProximoSemestre
142
+                    if prox_sem_id == None:
143
+                        cursor = connection.cursor()
144
+                        cursor.execute(f'INSERT INTO "CompanionApp_proximosemestre" (name, code, creditos, section, prof, hours, days, rooms, course_id_id) VALUES (\'{name}\', \'{code}\', {creditos}, \'{section}\', \'{prof}\', \'{hours}\', \'{days}\', \'{rooms}\', {course_id})')
135 145
           
136 146
         return JsonResponse({'message': 'se insertaron todos los cursos'}, status=status.HTTP_201_CREATED)
137 147
 
@@ -174,7 +184,7 @@ def selectCourseProxSemestre(request):
174 184
         return JsonResponse({'list': courses}, status=status.HTTP_200_OK)
175 185
 
176 186
 
177
-@api_view(['POST',])
187
+@api_view(['POST'])
178 188
 def addTakenCourse(request):
179 189
     if request.method == 'POST':
180 190
         # request params
@@ -254,7 +264,7 @@ def addTakenCourse(request):
254 264
         cursor = connection.cursor()
255 265
         cursor.execute(f'UPDATE "CompanionApp_user" set gpa = {gpa} where id={user_id}')
256 266
         
257
-        return JsonResponse({'list': 'se matriculo al estudiante'}, status=status.HTTP_201_CREATED)
267
+        return JsonResponse({'msg': 'Ok, you can see that course in your curriculum'}, status=status.HTTP_201_CREATED)
258 268
 
259 269
 
260 270
 @api_view(['GET'])
@@ -281,17 +291,18 @@ def getFacultyUser(request):
281 291
         facultyName = cursor.fetchone()
282 292
         return JsonResponse({'FacultyName': facultyName}, status=status.HTTP_200_OK)
283 293
 
294
+
284 295
 @api_view(['GET'])
285 296
 def getAllCoursesUserHasTaken(request):
286 297
     if request.method == 'GET':
287 298
         user_id = int(request.query_params['user_id'])
288 299
         cursor = connection.cursor()
289
-        cursor.execute(f'SELECT c.name, c.code, c.creditos, m.user_id_id, m.year, m.semestre, m.grade FROM "CompanionApp_curso" c INNER JOIN "CompanionApp_matricula" m ON (c.id = m.course_id_id) where m.user_id_id = {user_id} and m.grade <> \'N%\' order by m.year ASC, m.semestre ASC')
300
+        cursor.execute(f'SELECT c.name, c.code, c.creditos, m.user_id_id, m.year, m.semestre, m.grade, c.id FROM "CompanionApp_curso" c INNER JOIN "CompanionApp_matricula" m ON (c.id = m.course_id_id) where m.user_id_id = {user_id} and m.grade <> \'N%\' order by m.year ASC, m.semestre ASC')
290 301
         fetchCourses = cursor.fetchall()
291 302
         courses = []
292 303
         # convert courses to an array of objects
293 304
         for i in range(0, len(fetchCourses)):
294
-            dic = {'name': fetchCourses[i][0], 'code': fetchCourses[i][1], 'creditos': fetchCourses[i][2], 'year': fetchCourses[i][4], 'semestre': fetchCourses[i][5], 'grade': fetchCourses[i][6]}
305
+            dic = {'name': fetchCourses[i][0], 'code': fetchCourses[i][1], 'creditos': fetchCourses[i][2], 'year': fetchCourses[i][4], 'semestre': fetchCourses[i][5], 'grade': fetchCourses[i][6], 'course_id': fetchCourses[i][7]}
295 306
             courses.append(dic)
296 307
 
297 308
         return JsonResponse({'list': courses}, status=status.HTTP_200_OK)
@@ -314,6 +325,7 @@ def getAllCoursesBySemester(request):
314 325
             
315 326
         return JsonResponse({'list': courses}, status=status.HTTP_200_OK)
316 327
 
328
+
317 329
 @api_view(['POST',])
318 330
 def seeGPA(request):
319 331
     if request.method == 'POST':
@@ -323,7 +335,303 @@ def seeGPA(request):
323 335
         GPA = cursor.fetchone()
324 336
         return JsonResponse({'gpa': GPA}, status = status.HTTP_200_OK)
325 337
 
338
+@api_view(['POST',])
339
+def matricularProxSemestre(request):
340
+    if request.method == 'POST':
341
+        # data from request
342
+        user_id = int(request.data['user_id'])
343
+        isSummer = request.data['isSummer']
344
+        course_id = int(request.data['course_id'])
345
+
346
+
347
+        # selecting current year and current semester of user from database
348
+        cursor = connection.cursor()
349
+        cursor.execute(f'Select current_year, current_semester from "CompanionApp_user" where id = {user_id} ')
350
+        info = cursor.fetchone()
351
+        current_year = info[0]
352
+        current_semester = info[1]
353
+
354
+        # determining next semester and next year
355
+        if (current_semester == 2 and isSummer == 'false') or current_semester == 3:
356
+            next_semester = 1
357
+            next_year = current_year + 1
358
+        elif (current_semester == 2 and isSummer == 'true'):
359
+            next_semester = current_semester + 1 # 3
360
+            next_year = current_year # stays the same
361
+        elif current_semester == 1:
362
+            next_semester = current_semester + 1 # 2
363
+            next_year = current_year
364
+
365
+        # selecting all attributes of course from course_id
366
+        cursor = connection.cursor()
367
+        cursor.execute(f'Select * from "CompanionApp_proximosemestre" where id = {course_id} ')
368
+        info = cursor.fetchone() 
369
+        course_name = info[1]
370
+        course_code = info[2]
371
+        course_section = info[4]
372
+        course_prof = info[5]
373
+        course_hours = info[6]
374
+        course_days = info[7]
375
+        course_rooms = info[8]
376
+        course_id = info[9] # course_id in "CompanionApp_curso"
377
+        course_grade = 'N' # N de none, por ahora no hay nota
378
+        
379
+        # see if student already enrolled for the class
380
+        cursor = connection.cursor()
381
+        cursor.execute(f'Select id from "CompanionApp_matricula" where course_id_id={course_id} and section=\'{course_section}\' and prof=\'{course_prof}\' and horarios=\'{course_hours}\' and dias=\'{course_days}\' and salones=\'{course_rooms}\' and semestre={next_semester} and year={next_year} and user_id_id={user_id}')
382
+        info = cursor.fetchone() 
383
+        print(info)
384
+        if info != None:
385
+            return JsonResponse({'msg': 'Ya estabas matriculado'}, status=status.HTTP_201_CREATED)
386
+        else:
387
+            # enroll student
388
+            cursor = connection.cursor()
389
+            cursor.execute(f'INSERT INTO "CompanionApp_matricula" (section, prof, semestre, year, grade, salones, horarios, dias, course_id_id, user_id_id) VALUES (\'{course_section}\',\'{course_prof}\', {next_semester}, {next_year}, \'{course_grade}\', \'{course_rooms}\', \'{course_hours}\', \'{course_days}\', {course_id}, {user_id})')
390
+
391
+        return JsonResponse({'msg': 'te matriculaste a ' + course_code + '-' + course_section}, status=status.HTTP_201_CREATED)
392
+
393
+
394
+@api_view(['POST',])
395
+def getMyCurrentCourses(request):
396
+    if request.method == 'POST':
397
+        user_id = int(request.data['user_id'])
398
+        current_courses = [] 
399
+
400
+        # find current year of student
401
+        cursor = connection.cursor()
402
+        cursor.execute(f'select max(year) from "CompanionApp_matricula" where user_id_id={user_id}')
403
+        current_year = cursor.fetchone()
404
+
405
+        if current_year[0] == None:
406
+            return JsonResponse({'msg': 'No tienes cursos'}, status = status.HTTP_200_OK)
407
+
408
+        else:
409
+            current_year = int(current_year[0])
410
+
411
+
412
+        # find current semester of student, based on the current_year
413
+        cursor = connection.cursor()
414
+        cursor.execute(f'select max(semestre) from "CompanionApp_matricula" where year = {current_year}')
415
+        current_semester = cursor.fetchone()
416
+        current_semester = int(current_semester[0])
417
+
418
+        # find current courses based on current_semester and current_year
419
+        cursor = connection.cursor()
420
+        cursor.execute(f'select c.id, c.name, c.code, m.year, m.semestre, m.section, m.prof, m.salones, m.horarios, m.dias from "CompanionApp_matricula" m INNER JOIN "CompanionApp_curso" c on c.id = m.course_id_id where m.year = {current_year} and m.semestre={current_semester}')
421
+        fetchCourses = cursor.fetchall()
422
+
423
+        # convert courses array into dictionary
424
+        for i in range(0, len(fetchCourses)):
425
+            # if fetchCourses[i][2] == None, this means that the rest of the array will also be none. 
426
+            # The reason for this is that when users AddTakenCourses, they just add the course code
427
+            if fetchCourses[i][5] == None:
428
+                dic = {'id': fetchCourses[i][0], 'name': fetchCourses[i][1], 'code': fetchCourses[i][2], 'year': fetchCourses[i][3], 'semestre': fetchCourses[i][4]}
429
+            
430
+            # here we have all the elements because users enrolled from the courses in table ProximoSemestre
431
+            else:    
432
+                dic = {'id': fetchCourses[i][0], 'name': fetchCourses[i][1], 'code': fetchCourses[i][2], 'year': fetchCourses[i][3], 'semestre': fetchCourses[i][4], 'section': fetchCourses[i][5], 'prof': fetchCourses[i][6], 'salones': fetchCourses[i][7], 'horarios': fetchCourses[i][8], 'dias': fetchCourses[i][9]}
433
+
434
+            current_courses.append(dic)
435
+
326 436
 
437
+       
438
+
439
+    return JsonResponse({'list': current_courses}, status = status.HTTP_200_OK)
440
+
441
+@api_view(['PATCH',])
442
+def updateGradeAndGPA(request):
443
+    if request.method == 'PATCH':
444
+        new_grade = request.data['grade']
445
+        course_id = int(request.data['course_id'])
446
+        year = int(request.data['year'])
447
+        semestre = int(request.data['semestre'])
448
+        user_id = int(request.data['user_id'])
449
+        current_points = 0 # to deal with current_grade
450
+        new_points = 0 # to deal with new_grade
451
+
452
+        # points of new_grade
453
+        if new_grade == 'A':
454
+            new_points = 4
455
+        elif new_grade == 'B':
456
+            new_points = 3
457
+        elif new_grade == 'C':
458
+            new_points = 2
459
+        elif new_grade == 'D':
460
+            new_points = 1
461
+        elif new_grade == 'F':
462
+            new_points = 0
463
+
464
+        # get credits from the course
465
+        cursor = connection.cursor()
466
+        cursor.execute(f'select creditos from "CompanionApp_curso" where id={course_id}')
467
+        creditos = cursor.fetchone()
468
+        creditos = creditos[0]
469
+        
470
+        # select current grade
471
+        cursor = connection.cursor()
472
+        cursor.execute(f'select grade from "CompanionApp_matricula" where course_id_id={course_id} and user_id_id={user_id} and year={year} and semestre={semestre}')
473
+        current_grade = cursor.fetchone()
474
+        current_grade = current_grade[0]
475
+        print(current_grade)
476
+
477
+        # this means that the credits for this course had not been added to the column credits_taken from table "CompanionApp_curso"
478
+        if current_grade == 'N':
479
+            # get credits_taken. Then add the courses credits to credits_taken
480
+            cursor = connection.cursor()
481
+            cursor.execute(f'select credits_taken from "CompanionApp_user" where id={user_id}')
482
+            credits_taken = cursor.fetchone()
483
+            credits_taken = credits_taken[0]
484
+            new_credits_taken = credits_taken + creditos
485
+            print(new_credits_taken, 'New credits taken')
486
+
487
+            # get credits_taken_score. Then multiply credits * new_points and add it to credits_taken_score
488
+            cursor = connection.cursor()
489
+            cursor.execute(f'select credits_taken_score from "CompanionApp_user" where id={user_id}')
490
+            credits_taken_score = cursor.fetchone()
491
+            credits_taken_score = credits_taken_score[0]
492
+            new_credits_taken_score = credits_taken_score + (new_points * creditos)
493
+            print(new_credits_taken_score, 'New credits taken score')
494
+
495
+            # update gpa, credits_taken, credits_taken_score
496
+            gpa = (new_credits_taken_score / new_credits_taken)
497
+            gpa = float("{:.2f}".format(gpa))
498
+            print(gpa, 'new gpa')
499
+            cursor = connection.cursor()
500
+            cursor.execute(f'UPDATE "CompanionApp_user" set gpa = {gpa}, credits_taken = {new_credits_taken}, credits_taken_score={new_credits_taken_score} where id={user_id}')
501
+
502
+            # update grade in table CompanionApp_matricula
503
+            cursor = connection.cursor()
504
+            cursor.execute(f'UPDATE "CompanionApp_matricula" set grade=\'{new_grade}\' where user_id_id={user_id} and semestre={semestre} and year={year} and course_id_id={course_id} ')
505
+            return JsonResponse({'msg': 'Your GPA was updated to ' + str(gpa)}, status = status.HTTP_202_ACCEPTED)
506
+
507
+        # else student already has a grade and wants to replace it
508
+        else:
509
+            if current_grade == 'A':
510
+                current_points = 4
511
+            elif current_grade == 'B':
512
+                current_points = 3
513
+            elif current_grade == 'C':
514
+                current_points = 2
515
+            elif current_grade == 'D':
516
+                current_points = 1
517
+            elif current_grade == 'F':
518
+                current_points = 0
519
+            
520
+            # get credits_taken_score and credits_taken. Then substract (creditos * current_points) to credits_taken_score. Then add (creditos * new_points) to credits_taken_score
521
+            cursor = connection.cursor()
522
+            cursor.execute(f'select credits_taken_score, credits_taken from "CompanionApp_user" where id={user_id}')
523
+            results = cursor.fetchone()
524
+            credits_taken_score = results[0]
525
+            credits_taken = results[1]
526
+            new_credits_taken_score = credits_taken_score - (creditos * current_points)
527
+            new_credits_taken_score = new_credits_taken_score + (creditos * new_points)
528
+            print(new_credits_taken_score, 'new credits taken score')
529
+            print(credits_taken, 'credits taken')
530
+
531
+            # update gpa and credits_taken_score. credits_taken stays the same
532
+            gpa = (new_credits_taken_score / credits_taken)
533
+            gpa = float("{:.2f}".format(gpa))
534
+            print(gpa, 'new gpa')
535
+            cursor = connection.cursor()
536
+            cursor.execute(f'UPDATE "CompanionApp_user" set gpa = {gpa}, credits_taken_score={new_credits_taken_score} where id={user_id}')
537
+
538
+             # update grade in table CompanionApp_matricula
539
+            cursor = connection.cursor()
540
+            cursor.execute(f'UPDATE "CompanionApp_matricula" set grade=\'{new_grade}\' where user_id_id={user_id} and semestre={semestre} and year={year} and course_id_id={course_id} ')
541
+            return JsonResponse({'msg': 'Your GPA was updated to ' + str(gpa)}, status = status.HTTP_202_ACCEPTED)
542
+
543
+@api_view(['DELETE',])
544
+def deleteCourse(request):
545
+    if request.method == 'DELETE':
546
+        course_id = int(request.data['course_id'])
547
+        year = int(request.data['year'])
548
+        semestre = int(request.data['semestre'])
549
+        user_id = int(request.data['user_id'])
550
+
551
+        # get credits from the course
552
+        cursor = connection.cursor()
553
+        cursor.execute(f'select creditos from "CompanionApp_curso" where id={course_id}')
554
+        creditos = cursor.fetchone()
555
+        creditos = creditos[0]
556
+        print(creditos)
557
+        
558
+        # select current grade
559
+        cursor = connection.cursor()
560
+        cursor.execute(f'select grade from "CompanionApp_matricula" where course_id_id={course_id} and user_id_id={user_id} and year={year} and semestre={semestre}')
561
+        current_grade = cursor.fetchone()
562
+        current_grade = current_grade[0]
563
+        print(current_grade)
564
+
565
+        if current_grade == 'N':
566
+            # just delete course from table CompanionApp_matricula
567
+            cursor = connection.cursor()
568
+            cursor.execute(f'DELETE from "CompanionApp_matricula" where user_id_id={user_id} and course_id_id = {course_id} and year={year} and semestre={semestre}')
569
+            return JsonResponse({'msg': 'SUCCESS' }, status = status.HTTP_202_ACCEPTED)
570
+        
571
+        else:
572
+            # update credits_taken, credits_taken_score and gpa
573
+            current_points = 0
574
+            if current_grade == 'A':
575
+                current_points = 4
576
+            elif current_grade == 'B':
577
+                current_points = 3
578
+            elif current_grade == 'C':
579
+                current_points = 2
580
+            elif current_grade == 'D':
581
+                current_points = 1
582
+            elif current_grade == 'F':
583
+                current_points = 0
584
+            
585
+            # get credits_taken_score and credits_taken. Then, substract (creditos * current_points) to credits_taken_score and substract creditos to credits_taken
586
+            cursor = connection.cursor()
587
+            cursor.execute(f'select credits_taken_score, credits_taken from "CompanionApp_user" where id={user_id}')
588
+            results = cursor.fetchone()
589
+            credits_taken_score = results[0]
590
+            credits_taken = results[1]
591
+
592
+            new_credits_taken_score = credits_taken_score - (current_points * creditos)
593
+            new_credits_taken = credits_taken - creditos
594
+            gpa = new_credits_taken_score / new_credits_taken 
595
+            gpa = float("{:.2f}".format(gpa))
596
+            print(new_credits_taken, 'credits taken')
597
+            print(new_credits_taken_score, 'credits taken score')
598
+
599
+            # update gpa, credits_taken and credits_taken_score
600
+            cursor = connection.cursor()
601
+            cursor.execute(f'UPDATE "CompanionApp_user" set gpa = {gpa}, credits_taken = {new_credits_taken}, credits_taken_score={new_credits_taken_score} where id={user_id}')
602
+
603
+            # delete course from "CompanionApp_matricula"
604
+            cursor = connection.cursor()
605
+            cursor.execute(f'DELETE from "CompanionApp_matricula" where user_id_id={user_id} and course_id_id = {course_id} and year={year} and semestre={semestre}')
606
+
607
+
608
+            return JsonResponse({'msg': 'SUCCESS' }, status = status.HTTP_202_ACCEPTED)
609
+
610
+@api_view(['PATCH',])
611
+def updateSemesterAndYear(request):
612
+    if request.method == 'PATCH':
613
+        user_id = int(request.data['user_id'])
614
+        year = int(request.data['year'])
615
+        semestre = int(request.data['semester'])
616
+
617
+        # update semestre and year for user. This is for knowing which year and semester he/she is currently in
618
+        cursor = connection.cursor()
619
+        cursor.execute(f'UPDATE "CompanionApp_user" set current_year={year}, current_semester={semestre} where id={user_id}')
620
+        return JsonResponse({'msg': 'SUCCESS' }, status = status.HTTP_202_ACCEPTED)
621
+        
622
+
623
+@api_view(['POST',])
624
+def getSemesterAndYear(request):
625
+    if request.method == 'POST':
626
+        user_id = int(request.data['user_id'])
627
+
628
+        cursor = connection.cursor()
629
+        cursor.execute(f'select current_year, current_semester from "CompanionApp_user" where id={user_id}')
630
+        info = cursor.fetchone()
631
+        year = info[0]
632
+        semestre = info[1]
633
+        return JsonResponse({'msg': {'year': year, 'semestre': semestre} }, status = status.HTTP_202_ACCEPTED)
634
+        
327 635
 
328 636
 
329 637
 
@@ -335,3 +643,4 @@ def hello_world(request):
335 643
     return JsonResponse({'msg': 'no'})
336 644
 
337 645
 
646
+# delete course and update credits_takenv

BIN
server/restful/__pycache__/settings.cpython-38.pyc View File


BIN
server/restful/__pycache__/urls.cpython-38.pyc View File


+ 1
- 0
server/restful/settings.py View File

@@ -75,6 +75,7 @@ INSTALLED_APPS = [
75 75
 
76 76
 SITE_ID = 4
77 77
 
78
+
78 79
 MIDDLEWARE = [
79 80
     'django.middleware.security.SecurityMiddleware',
80 81
     'django.contrib.sessions.middleware.SessionMiddleware',