Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Reformatted again
Browse files Browse the repository at this point in the history
  • Loading branch information
dorukgezici committed Dec 1, 2019
1 parent bc49ec5 commit 0a6e61b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 52 deletions.
32 changes: 16 additions & 16 deletions ituscheduler/apps/scheduler/rest_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ def course_remove(request):
course = get_object_or_404(Course, crn=crn)
if schedule.user != user and course not in schedule:
return Response({
'error': 'unauthorized attempt.'
}, status=HTTP_401_UNAUTHORIZED)
'error': 'unauthorized attempt.'
}, status=HTTP_401_UNAUTHORIZED)

schedule.courses.remove(course)

if len(schedule.courses.all()) == 0:
schedule.delete()

return Response({
'success': 'Successfuly removed course {}'.format(course.crn)
})
'success': 'Successfuly removed course {}'.format(course.crn)
})


@api_view(['POST'])
Expand All @@ -121,15 +121,15 @@ def course_replace(request):

if schedule.user != user and old_course not in schedule and new_course in schedule:
return Response({
'error': 'Unauthorized attempt.'
}, status=HTTP_401_UNAUTHORIZED)
'error': 'Unauthorized attempt.'
}, status=HTTP_401_UNAUTHORIZED)

schedule.courses.remove(old_course)
schedule.courses.add(new_course)

return Response({
'success': 'Replaced {} with {}'.format(old_crn, new_crn)
})
'success': 'Replaced {} with {}'.format(old_crn, new_crn)
})


@api_view(['POST'])
Expand Down Expand Up @@ -162,14 +162,14 @@ def add_to_schedule(request, id):
notification.save()

return Response({
'success': 'attempt is accomplished'
})
'success': 'attempt is accomplished'
})
else:
raise Exception("Unauthorized attempt")
except Exception as error:
return Response({
'error': error
})
'error': error
})


@api_view(["POST"])
Expand All @@ -185,10 +185,10 @@ def read_notification(request):
notification.save()

return Response({
'success': 'attempt is accomplished'
})
'success': 'attempt is accomplished'
})

except Exception as error:
return Response({
'error': error
})
'error': error
})
4 changes: 3 additions & 1 deletion ituscheduler/apps/scheduler/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ <h2 class="panel-title">My Schedules</h2>
<div style="margin-bottom: 5px;" class="col-md-6 col-xs-9">
<a href="javascript:(function(){var crn='
{% for course in my_courses %}{{ course.crn }}, {% endfor %}';crn=crn.split(', '); for(var i=0;i<crn.length-1;i++){var object_will_be_placed=document.getElementById('crn_id'+(i+1));object_will_be_placed.value=parseInt(crn[i])}void(0);})();"
{% for course in my_courses %}{{ course.crn }}, {% endfor %}';crn=crn.split(', '); for(var i=0;i<crn.length-1;i++){var object_will_be_placed=document.getElementById(';crn_id;'+(i+1));object_will_be_placed.value=parseInt(crn[i])}void(0);})();"
class="btn btn-block btn-primary">Fill CRNs</a>
</div>
<div class="col-md-3 col-xs-3">
Expand Down
20 changes: 10 additions & 10 deletions ituscheduler/apps/scheduler/templates/sis.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<META HTTP-EQUIV="Content-Script-Type" NAME="Default_Script_Language" CONTENT="text/javascript">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
Hide
JavaScript
from
older
browsers
Hide;
JavaScript;
from;
older;
browsers;
var submitcount = 0;

function checkSubmit() {
Expand All @@ -31,11 +31,11 @@
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
Hide
JavaScript
from
older
browsers
Hide;
JavaScript;
from;
older;
browsers;

// Function to open a window
function windowOpen(window_url) {
Expand Down
44 changes: 22 additions & 22 deletions ituscheduler/apps/scheduler/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ def remove_my_courses(request):
try:
request.user.courses.clear()
return JsonResponse({
"successful": True
})
"successful": True
})
except Exception as error:
return JsonResponse({
"successful": False,
"error": error
})
"successful": False,
"error": error
})


@login_required
Expand All @@ -342,13 +342,13 @@ def add_course(request):
else:
my_courses.add(course.crn)
return JsonResponse({
"successful": True
})
"successful": True
})
except Exception as error:
return JsonResponse({
"successful": False,
"error": error
})
"successful": False,
"error": error
})


@login_required
Expand All @@ -363,13 +363,13 @@ def select_schedule(request):
raise Exception("You are not authorized to select that schedule.")
except Exception as error:
return JsonResponse({
"successful": False,
"error": str(error)
})
"successful": False,
"error": str(error)
})
return JsonResponse({
"successful": True,
"scheduleId": schedule_id
})
"successful": True,
"scheduleId": schedule_id
})


@login_required
Expand All @@ -385,10 +385,10 @@ def delete_schedule(request):
raise Exception("You are not authorized to delete that schedule.")
except Exception as error:
return JsonResponse({
"successful": False,
"error": str(error)
})
"successful": False,
"error": str(error)
})
return JsonResponse({
"successful": True,
"scheduleId": schedule_id
})
"successful": True,
"scheduleId": schedule_id
})
2 changes: 1 addition & 1 deletion ituscheduler/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

ADMINS = [('Doruk', 'doruk@gezici.me')]
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '.ituscheduler.com', '.elasticbeanstalk.com']
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '.ituscheduler.com']
INTERNAL_IPS = ['127.0.0.1']

EC2_PRIVATE_IP = None
Expand Down
1 change: 1 addition & 0 deletions ituscheduler/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .base import *
from .secrets import *

DEBUG = False
Expand Down
4 changes: 2 additions & 2 deletions ituscheduler/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
'home': IndexViewSitemap,
'pages': StaticViewSitemap,
'courses': GenericSitemap({
"queryset": MajorCode.objects.all()
}, priority=0.7)
"queryset": MajorCode.objects.all()
}, priority=0.7)
}
}, name='django.contrib.sitemaps.views.sitemap'),
path('oauth/', include('social_django.urls', namespace='social')),
Expand Down

0 comments on commit 0a6e61b

Please sign in to comment.