Skip to content

Commit

Permalink
All BUgs Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hardlyhuman committed Dec 3, 2017
1 parent fc2fd75 commit 1d5bc96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions students/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
from __future__ import unicode_literals

from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.utils import timezone
from home.models import *
from django.core.urlresolvers import reverse


@login_required(login_url="/login/")
Expand Down Expand Up @@ -223,7 +224,7 @@ def registerCourses(request):
'''
This function allows add/drop a course for a student
'''
print (request.POST)

user = request.user
StudentObject = Personnel.objects.filter(LDAP=user.id)
courses = Courses.objects.all()
Expand All @@ -234,15 +235,14 @@ def registerCourses(request):
registerStudent = CourseByStudent.create(Student_ID=StudentObject[0], Course_ID=course,
Reg_Date=datetime.datetime.now())
registerStudent.save()
print(registerStudent)

elif (CourseByStudent.count() != 0 and not request.POST.get(str(course.Course_ID))):
CourseByStudent.delete()
# registerStudent = CourseByStudent.create(Student_ID=StudentObject[0], Course_ID=course,
# Reg_Date=datetime.datetime.now())

return render(request, "student/index.html", {})

@login_required(login_url="/login/")
return redirect(reverse('students:index'))

@login_required
def upcoming_events(request):
'''
This function lists all the events
Expand Down

0 comments on commit 1d5bc96

Please sign in to comment.