diff options
author | parth | 2012-04-12 12:44:16 +0530 |
---|---|---|
committer | parth | 2012-04-12 12:44:16 +0530 |
commit | ccce1bf405911f7f504c3870342f338c6ed47429 (patch) | |
tree | 0a50f9daad33a1a6aae431ba6d86902df32f7d10 | |
parent | 91f1f373beaff8a18dfb40fc0f8a7e7af160d9e0 (diff) | |
parent | 4075d788857f88897e4f883e716c350d5f495cd8 (diff) | |
download | aloha-ccce1bf405911f7f504c3870342f338c6ed47429.tar.gz aloha-ccce1bf405911f7f504c3870342f338c6ed47429.tar.bz2 aloha-ccce1bf405911f7f504c3870342f338c6ed47429.zip |
Merge https://github.com/FOSSEE/aloha
-rw-r--r-- | aloha/allotter/forms.py | 4 | ||||
-rw-r--r-- | aloha/allotter/views.py | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/aloha/allotter/forms.py b/aloha/allotter/forms.py index 3547f88..5112884 100644 --- a/aloha/allotter/forms.py +++ b/aloha/allotter/forms.py @@ -106,11 +106,11 @@ class UserLoginForm(forms.Form): ##Authentication part user = authenticate(username = u_name, password = pwd) + if not user: + raise forms.ValidationError("Registration Number doesn't match.") user_profile = user.get_profile() user_profile.dd_no = dd_no user_profile.save() - if not user: - raise forms.ValidationError("Application Number or Registration Number doesn't match.") return user def __init__(self, *args, **kwargs): diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py index de7cd92..d94a1dc 100644 --- a/aloha/allotter/views.py +++ b/aloha/allotter/views.py @@ -61,7 +61,12 @@ def submit_details(request): Get the secondary email address, phone number and save it to the Profile. """ user = request.user - + #Checking whether user had done the allottment previously. + user_profile = user.get_profile() + user_application = user_profile.application + if user_application.quit_status: + return redirect('/allotter/complete/') + if request.method == "POST": form = UserDetailsForm(user, request.POST) if form.is_valid(): @@ -121,6 +126,11 @@ def apply(request): if not sec_email: #Not Entered Secondary email return redirect('/allotter/details/') + user_profile = user.get_profile() + user_application = user_profile.application + if user_application.quit_status: + return redirect('/allotter/complete/') + context = get_details(user) return render(request, 'allotter/apply.html', context) @@ -142,12 +152,6 @@ def user_logout(request): logout(request) return render(request, 'allotter/logout.html') -##http://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-in-python-whilst-preserving-##order -def rem_dup(seq): - seen = set() - seen_add = seen.add - return [ x for x in seq if x not in seen and not seen_add(x)] - #TODO: Extensive Testing @login_required |