summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorprathamesh2017-11-07 13:12:06 +0530
committerprathamesh2017-11-07 13:12:06 +0530
commit2eee8fa300a4776647a7be7fdb9dee082f4d6fd8 (patch)
tree4accd8bd91529d6458fbe940f31a3a5e42a874aa /yaksh/views.py
parent4c1ddc15f3b9a15bee49ac2f6640c8ed311f7151 (diff)
parent807a52e45a9b6c6ac64a7a5e4bd8248900fb4367 (diff)
downloadonline_test-2eee8fa300a4776647a7be7fdb9dee082f4d6fd8.tar.gz
online_test-2eee8fa300a4776647a7be7fdb9dee082f4d6fd8.tar.bz2
online_test-2eee8fa300a4776647a7be7fdb9dee082f4d6fd8.zip
Merge branch 'master' of https://github.com/FOSSEE/online_test into detailed_csv_download_quiz
Resolved Conflicts: CHANGELOG.txt
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 3c57b83..0ba3270 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -796,8 +796,10 @@ def courses(request):
ci = RequestContext(request)
if not is_moderator(user):
raise Http404('You are not allowed to view this page')
- courses = Course.objects.filter(creator=user, is_trial=False)
- allotted_courses = Course.objects.filter(teachers=user, is_trial=False)
+ courses = Course.objects.filter(
+ creator=user, is_trial=False).order_by('-active', '-id')
+ allotted_courses = Course.objects.filter(
+ teachers=user, is_trial=False).order_by('-active', '-id')
context = {'courses': courses, "allotted_courses": allotted_courses}
return my_render_to_response('yaksh/courses.html', context,
context_instance=ci)
@@ -1449,7 +1451,6 @@ def view_profile(request):
@login_required
-@has_profile
@email_verified
def edit_profile(request):
""" edit profile details facility for moderator and students """
@@ -1461,7 +1462,10 @@ def edit_profile(request):
else:
template = 'user.html'
context = {'template': template}
- profile = Profile.objects.get(user_id=user.id)
+ try:
+ profile = Profile.objects.get(user_id=user.id)
+ except Profile.DoesNotExist:
+ profile = None
if request.method == 'POST':
form = ProfileForm(request.POST, user=user, instance=profile)