Private
Public Access
1
0

instantplans

This commit is contained in:
2023-08-14 21:41:35 +02:00
parent 87a65cd5f8
commit cd9fba9121
5 changed files with 21 additions and 3 deletions

View File

@@ -848,7 +848,12 @@ def rower_register_view(request):
weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
nextpage = request.POST['next']
theuser = User.objects.create_user(username, password=password)
try:
theuser = User.objects.create_user(username, password=password)
except:
messages.error(request, "This user name already exists, choose another one")
url = reverse('rower_register_view')
return HttpResponseRedirect(url)
theuser.first_name = first_name
theuser.last_name = last_name
theuser.email = email

View File

@@ -2849,8 +2849,15 @@ def rower_select_instantplan(request, id=0):
r = getrequestrower(request, userid=id)
# get and present available plans
ips = InstantPlan.objects.all().order_by(
"name", "sessionsperweek", "hoursperweek", "duration", "id")
ips = InstantPlan.objects.filter(private=False)
if not request.user.is_anonymous:
ips2 = InstantPlan.objects.filter(owner=request.user)
ips = ips | ips2
ips = ips.order_by("private", "name", "sessionsperweek", "hoursperweek", "duration", "id")
breadcrumbs = [
{