in
PYL-R1714573 #grading_type = request.POST['Type']
574 scheme = 0
575 scsddc = request.POST['scsddc']
576 if scsddc == None or scsddc == "" or scsddc == "null":577 return JsonResponse({"Error": "Invalid scsddc"}, status=403)
578 csection = CourseSection.objects.get(scsddc=scsddc)
579 for student_info in csection.student_info.all():
529def marks_info(request):
530 scsddc = request.POST['scsddc']
531 print(scsddc)
532 if scsddc == None or scsddc == "" or scsddc == "null":533 return JsonResponse({"Failed": "Invalid Input Parameters"}, status=403)
534 print(scsddc)
535 marks = SectionMarks.objects.filter(scsddc=scsddc).values()
474 def post(self, request, *args, **kwargs):
475 username = request.POST['username']
476 password = request.POST['password']
477 if username == "" or password == "":478 return Response(data="Empty Usename or Password Field.", status=400)
479
480 user = authenticate(request, username=username, password=password)
To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in
it instead of checking for equality against each of the values.
This is faster, less verbose, and more readable.
if x == 1 or x == 2 or x == 3:
do_something()
if x in (1, 2, 3):
do_something()