From 5fa3e7ebd64fdf51b8b422f947b9bed8932bb79d Mon Sep 17 00:00:00 2001 From: Dipanshu Date: Sat, 6 Jul 2019 18:02:31 +0530 Subject: [PATCH 1/3] intial setup --- carpool/templates/signup.html | 5 ----- carpool/templates/signupcomp.html | 1 + carpool/urls.py | 1 + carpool/views.py | 12 ++++++++---- 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 carpool/templates/signupcomp.html diff --git a/carpool/templates/signup.html b/carpool/templates/signup.html index 870aa06..2b0753a 100644 --- a/carpool/templates/signup.html +++ b/carpool/templates/signup.html @@ -57,11 +57,6 @@

Register

--> {{ error }} - {% if done == True %} - - {% endif %}
Already a member? Login Here
diff --git a/carpool/templates/signupcomp.html b/carpool/templates/signupcomp.html new file mode 100644 index 0000000..c7a05c3 --- /dev/null +++ b/carpool/templates/signupcomp.html @@ -0,0 +1 @@ +

please check your email a confirmation link has been sent to you by hackweek@example.com

\ No newline at end of file diff --git a/carpool/urls.py b/carpool/urls.py index 849f2c2..f901413 100644 --- a/carpool/urls.py +++ b/carpool/urls.py @@ -5,6 +5,7 @@ urlpatterns = [ path('new/', views.new, name="new"), + path('signupcomp/',views.signupcomp, name='signupcomp'), path('', views.dashboard, name="dashboard"), path('add/', views.addPool, name="addPool"), path('log/', views.log, name="log"), diff --git a/carpool/views.py b/carpool/views.py index 6326a23..8066d35 100644 --- a/carpool/views.py +++ b/carpool/views.py @@ -24,15 +24,16 @@ def IITmail(request): def new(request): error="" - done=False if request.user.is_authenticated: return HttpResponseRedirect('/') - if request.method == 'POST': + elif request.method == 'POST': form = SignUpForm(request.POST) if not IITmail(request): error+="Please use an IIT Mandi email." + return render(request, 'signup.html', {'form': form, 'error': error,}) elif not form.is_valid(): error+="Invalid information/ Email already in use." + return render(request, 'signup.html', {'form': form, 'error': error,}) else: user = form.save(commit=False) user.is_active = False @@ -47,12 +48,15 @@ def new(request): }) to_email = form.cleaned_data.get('email') send_mail(mail_subject, message, 'Hackweek@example.com', [to_email], fail_silently=False) - done=True + HttpResponseRedirect("{% url 'polls.signupcomp' %}") # email = EmailMessage(mail_subject, message, to=[to_email]) # email.send() else: form = SignUpForm() - return render(request, 'signup.html', {'form': form, 'error': error, 'done': done, }) + return render(request, 'signup.html', {'form': form, 'error': error,}) + +def signupcomp(request): + return render(request,"signupcomp.html") def log(request): From e9f203dd94cf7d2d566f548923200264d7d899bb Mon Sep 17 00:00:00 2001 From: Dipanshu Date: Sat, 6 Jul 2019 18:40:00 +0530 Subject: [PATCH 2/3] initial setup --- carpool/forms.py | 1 - carpool/templates/signupcomp.html | 44 ++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/carpool/forms.py b/carpool/forms.py index f6dc7b7..f6bd5b4 100644 --- a/carpool/forms.py +++ b/carpool/forms.py @@ -46,7 +46,6 @@ def __init__(self, *args, **kwargs): ) - class filterForm(forms.Form): source = forms.ChoiceField(choices=CHOICES, label="From", initial='', widget=forms.Select()) dest = forms.ChoiceField(choices=CHOICES, label="To", initial='', widget=forms.Select()) diff --git a/carpool/templates/signupcomp.html b/carpool/templates/signupcomp.html index c7a05c3..e32a1c2 100644 --- a/carpool/templates/signupcomp.html +++ b/carpool/templates/signupcomp.html @@ -1 +1,43 @@ -

please check your email a confirmation link has been sent to you by hackweek@example.com

\ No newline at end of file + +{% load static %} + + + + + + My ride + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

please check your email. A confirmation link has been sent to you by hackweek@example.com

+ + + \ No newline at end of file From 8befa9e9b66cdba1775c0f78063dc02c71a82a62 Mon Sep 17 00:00:00 2001 From: Dipanshu Date: Wed, 17 Jul 2019 08:53:16 +0530 Subject: [PATCH 3/3] changes for the execution of the page --- carpool/views.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/carpool/views.py b/carpool/views.py index 2190d50..774d4f0 100644 --- a/carpool/views.py +++ b/carpool/views.py @@ -26,14 +26,12 @@ def new(request): error="" if request.user.is_authenticated: return HttpResponseRedirect('/') - elif request.method == 'POST': + if request.method == 'POST': form = SignUpForm(request.POST) if not IITmail(request): error+="Please use an IIT Mandi email." - return render(request, 'signup.html', {'form': form, 'error': error,}) - elif not form.is_valid(): + if not form.is_valid(): error+="Invalid information/ Email already in use." - return render(request, 'signup.html', {'form': form, 'error': error,}) else: user = form.save(commit=False) user.is_active = False @@ -48,12 +46,12 @@ def new(request): }) to_email = form.cleaned_data.get('email') send_mail(mail_subject, message, 'Hackweek@example.com', [to_email], fail_silently=False) - HttpResponseRedirect("{% url 'polls.signupcomp' %}") + return HttpResponseRedirect("/signupcomp/") # email = EmailMessage(mail_subject, message, to=[to_email]) # email.send() else: form = SignUpForm() - return render(request, 'signup.html', {'form': form, 'error': error,}) + return render(request, 'signup.html', {'form': form, 'error': error,}) def signupcomp(request): return render(request,"signupcomp.html")