summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-04-13 16:58:00 +0530
committerPrabhu Ramachandran2016-04-13 16:58:00 +0530
commit97bdb23fbacc3e625beb96efdf58431f42604a81 (patch)
tree06d3cd76a3f38b4ceb8ba7e93d64db12ba9f5b7f /yaksh/views.py
parent2dfef7f76cb04b34901650dc9ae0f41ef394d6ba (diff)
parent523390f284b93e10af35058931b06eed1550700c (diff)
downloadonline_test-97bdb23fbacc3e625beb96efdf58431f42604a81.tar.gz
online_test-97bdb23fbacc3e625beb96efdf58431f42604a81.tar.bz2
online_test-97bdb23fbacc3e625beb96efdf58431f42604a81.zip
Merge pull request #91 from prathamesh920/migration_to_django_1_9
Migration from django 1.6 to django 1.9
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index c65fb26..8b0a131 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -359,9 +359,7 @@ def start(request, questionpaper_id=None, attempt_num=None):
context_instance=ci)
else:
ip = request.META['REMOTE_ADDR']
- try:
- profile = user.get_profile()
- except Profile.DoesNotExist:
+ if not hasattr(user, 'profile'):
msg = 'You do not have a profile and cannot take the quiz!'
raise Http404(msg)
new_paper = quest_paper.make_answerpaper(user, ip, attempt_num)
@@ -724,11 +722,7 @@ def get_user_data(username, questionpaper_id=None):
'-attempt_number')
data = {}
- try:
- profile = user.get_profile()
- except Profile.DoesNotExist:
- # Admin user may have a paper by accident but no profile.
- profile = None
+ profile = user.profile if hasattr(user, 'profile') else None
data['user'] = user
data['profile'] = profile
data['papers'] = papers