registration form (just copy paste of user registration)
This commit is contained in:
@@ -124,7 +124,7 @@ class RowerPlanMiddleWare(object):
|
|||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
|
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
if request.user.is_authenticated and request.user.rower.rowerplan != 'basic':
|
if request.user.is_authenticated and request.user.rower.rowerplan not in ['basic','freecoach']:
|
||||||
if request.user.rower.paymenttype == 'single':
|
if request.user.rower.paymenttype == 'single':
|
||||||
if request.user.rower.planexpires < timezone.now().date():
|
if request.user.rower.planexpires < timezone.now().date():
|
||||||
messg = 'Your paid plan has expired. We have reset you to a free basic plan.'
|
messg = 'Your paid plan has expired. We have reset you to a free basic plan.'
|
||||||
|
|||||||
51
rowers/templates/freecoach_registration_form.html
Normal file
51
rowers/templates/freecoach_registration_form.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{% extends "newbase.html" %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
{% load rowerfilters %}
|
||||||
|
{% block title %}New User Registration{% endblock title %}
|
||||||
|
{% block meta %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
{% block main %}
|
||||||
|
<h1>New Coach Registration (free Coach Plan)</h1>
|
||||||
|
<ul class="main-content">
|
||||||
|
<li class="grid_2">
|
||||||
|
<div id="registrationform">
|
||||||
|
|
||||||
|
{% if form.errors %}
|
||||||
|
<p style="color: red;">
|
||||||
|
Please correct the error{{ form.errors|pluralize }} below.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table width=100%>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
<a href="/rowers/legal/">Terms of Service</a>
|
||||||
|
<input type="hidden" name="next" value="{{ next }}"/>
|
||||||
|
<input type="submit" value="Submit">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="grid_2">
|
||||||
|
|
||||||
|
<p> To use rowsandall, you need to register and agree with the Terms of Service. </p>
|
||||||
|
<p> Registration is free. </p>
|
||||||
|
|
||||||
|
<p>Some of our advanced services only work if you give us your
|
||||||
|
(approximate) birth date, sex and weight category, with 72.5 kg the
|
||||||
|
bounday between heavies and lighties for men, and 59 kg for women.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Also, we are restricting access to the site to 16 years and older
|
||||||
|
because of EU data protection regulations.</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock main %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include 'menu_help.html' %}
|
||||||
|
{% endblock %}
|
||||||
@@ -51,6 +51,10 @@ def nogoals(user):
|
|||||||
date__gte=datetime.date.today())
|
date__gte=datetime.date.today())
|
||||||
return len(targets)==0
|
return len(targets)==0
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def notfree(rower):
|
||||||
|
return rower.rowerplan not in ['basic','freecoach']
|
||||||
|
|
||||||
def strfdelta(tdelta):
|
def strfdelta(tdelta):
|
||||||
minutes,seconds = divmod(tdelta.seconds,60)
|
minutes,seconds = divmod(tdelta.seconds,60)
|
||||||
tenths = int(tdelta.microseconds/1e5)
|
tenths = int(tdelta.microseconds/1e5)
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ urlpatterns = [
|
|||||||
# re_path(r'^paypaltest', TemplateView.as_view(template_name='paypaltest.html'),name='paypaltest'),
|
# re_path(r'^paypaltest', TemplateView.as_view(template_name='paypaltest.html'),name='paypaltest'),
|
||||||
re_path(r'^legal', TemplateView.as_view(template_name='legal.html'),name='legal'),
|
re_path(r'^legal', TemplateView.as_view(template_name='legal.html'),name='legal'),
|
||||||
re_path(r'^register/$',views.rower_register_view,name='rower_register_view'),
|
re_path(r'^register/$',views.rower_register_view,name='rower_register_view'),
|
||||||
|
re_path(r'^coachregister/$',views.freecoach_register_view,name='freecoach_register_view'),
|
||||||
re_path(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
re_path(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/workflow/$',views.workout_workflow_view,
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/workflow/$',views.workout_workflow_view,
|
||||||
name='workout_workflow_view'),
|
name='workout_workflow_view'),
|
||||||
|
|||||||
@@ -566,6 +566,83 @@ def rower_register_view(request):
|
|||||||
{'form':form,
|
{'form':form,
|
||||||
'next':nextpage,})
|
'next':nextpage,})
|
||||||
|
|
||||||
|
# User registration
|
||||||
|
def freecoach_register_view(request):
|
||||||
|
|
||||||
|
nextpage = request.GET.get('next','/rowers/me/teams/')
|
||||||
|
if nextpage == '':
|
||||||
|
nextpage = '/rowers/me/teams/'
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
#form = RegistrationFormUniqueEmail(request.POST)
|
||||||
|
form = RegistrationFormSex(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
first_name = form.cleaned_data['first_name']
|
||||||
|
last_name = form.cleaned_data['last_name']
|
||||||
|
email = form.cleaned_data['email']
|
||||||
|
password = form.cleaned_data['password1']
|
||||||
|
username = form.cleaned_data['username']
|
||||||
|
sex = form.cleaned_data['sex']
|
||||||
|
birthdate = form.cleaned_data['birthdate']
|
||||||
|
weightcategory = form.cleaned_data['weightcategory']
|
||||||
|
adaptiveclass = form.cleaned_data['adaptiveclass']
|
||||||
|
nextpage = request.POST['next']
|
||||||
|
theuser = User.objects.create_user(username,password=password)
|
||||||
|
theuser.first_name = first_name
|
||||||
|
theuser.last_name = last_name
|
||||||
|
theuser.email = email
|
||||||
|
theuser.save()
|
||||||
|
|
||||||
|
birthdate = birthdate.replace(tzinfo=None)
|
||||||
|
|
||||||
|
therower = Rower(user=theuser,sex=sex,birthdate=birthdate,
|
||||||
|
weightcategory=weightcategory,
|
||||||
|
adaptiveclass=adaptiveclass,
|
||||||
|
rowerplan='freecoach')
|
||||||
|
|
||||||
|
therower.save()
|
||||||
|
|
||||||
|
# create default favorite charts
|
||||||
|
add_defaultfavorites(therower)
|
||||||
|
|
||||||
|
|
||||||
|
# Create and send email
|
||||||
|
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||||
|
subject = "Thank you for registering on rowsandall.com"
|
||||||
|
from_address = 'Sander Roosendaal <info@rowsandall.com>'
|
||||||
|
|
||||||
|
d = {'first_name':theuser.first_name}
|
||||||
|
|
||||||
|
send_template_email(from_address,[fullemail],
|
||||||
|
subject,'registeremail.html',d)
|
||||||
|
|
||||||
|
|
||||||
|
subject2 = "New Free Coach"
|
||||||
|
message2 = "New Free Coach registered.\n"
|
||||||
|
message2 += fullemail + "\n"
|
||||||
|
message2 += "User name: "+username
|
||||||
|
|
||||||
|
send_mail(subject2, message2,
|
||||||
|
'Rowsandall Server <info@rowsandall.com>',
|
||||||
|
['roosendaalsander@gmail.com'])
|
||||||
|
|
||||||
|
theuser = authenticate(username=username,password=password)
|
||||||
|
login(request,theuser)
|
||||||
|
|
||||||
|
return HttpResponseRedirect(nextpage)
|
||||||
|
|
||||||
|
else:
|
||||||
|
return render(request,
|
||||||
|
"freecoach_registration_form.html",
|
||||||
|
{'form':form,
|
||||||
|
'next':nextpage,})
|
||||||
|
else:
|
||||||
|
form = RegistrationFormSex()
|
||||||
|
return render(request,
|
||||||
|
"freecoach_registration_form.html",
|
||||||
|
{'form':form,
|
||||||
|
'next':nextpage,})
|
||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
def transactions_view(request):
|
def transactions_view(request):
|
||||||
if not request.user.is_staff:
|
if not request.user.is_staff:
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.rower.planexpires and user.rower.rowerplan != 'basic' and user.rower.paymenttype == 'single'%}
|
{% if user.rower.planexpires and user.rower|notfree and user.rower.paymenttype == 'single'%}
|
||||||
{% if user.rower.planexpires|is_future_date %}
|
{% if user.rower.planexpires|is_future_date %}
|
||||||
{% if user.rower.planexpires|date_dif|ddays < 4 %}
|
{% if user.rower.planexpires|date_dif|ddays < 4 %}
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
|
|||||||
Reference in New Issue
Block a user