diff options
author | Akshen | 2017-11-07 13:11:04 +0530 |
---|---|---|
committer | Akshen | 2017-11-07 13:11:04 +0530 |
commit | 0c9c80e6068f3a279ebf0f99f8c121d7e3e55117 (patch) | |
tree | a23a6676089d0467e2e55faa47fc4d5cd4cb6f69 /yaksh/views.py | |
parent | af8507e6e6ada08acf56c6fd1db297fc354fe293 (diff) | |
parent | 807a52e45a9b6c6ac64a7a5e4bd8248900fb4367 (diff) | |
download | online_test-0c9c80e6068f3a279ebf0f99f8c121d7e3e55117.tar.gz online_test-0c9c80e6068f3a279ebf0f99f8c121d7e3e55117.tar.bz2 online_test-0c9c80e6068f3a279ebf0f99f8c121d7e3e55117.zip |
Fix Conflicts in CHANGELOG.txt
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index b4cb844..63da956 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -792,8 +792,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) @@ -1406,7 +1408,6 @@ def view_profile(request): @login_required -@has_profile @email_verified def edit_profile(request): """ edit profile details facility for moderator and students """ @@ -1418,7 +1419,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) |