Private
Public Access
1
0

first version

This commit is contained in:
2025-04-13 17:28:51 +02:00
parent f56eee0d92
commit 9ef9138fc6
7 changed files with 147 additions and 3 deletions

View File

@@ -4210,3 +4210,46 @@ def planmacrocyclebymonth(request, id=0, userid=0): # pragma: no cover
'thismesoid': str(mesos[0].id)})
return HttpResponseRedirect(url)
@user_passes_test(can_plan, login_url="/rowers/paidplans",
message="This functionality requires a Pro plan",
redirect_field_name=None)
def nextweekplan_view(request):
r = getrower(request.user)
form = NextWeekJsonForm()
if request.method == "POST":
form = NextWeekJsonForm(request.POST, request.FILES)
if form.is_valid():
f = form.cleaned_data['file']
if f is not None:
filename, path_and_filename = handle_uploaded_file(f)
try:
with open(path_and_filename,'r') as ff:
data = json.load(ff)
except:
messages.error(request,"Hmm, invalid file")
create_next_week_from_json(data, r)
messages.info(request,"Your planned sessions were created")
active = 'nav-plan'
breadcrumbs = [
{
'url': reverse('plannedsessions_view'),
'name': 'Sessions'
},
{
'url': reverse('nextweekplan_view'),
'name': "Next week"
},
]
return render(request,
'loadnextweek.html',
{'rower': r,
'form': form,
'active': active,
'breadcrumbs': breadcrumbs})

View File

@@ -120,7 +120,7 @@ from rowers.forms import (
TrainingPlanBillingForm, InstantPlanSelectForm,
TrainingZonesForm, InstrokeForm, InStrokeMultipleCompareForm,
ForceCurveMultipleCompareForm, PlanByRscoreForm,
AssignChoices,
AssignChoices, NextWeekJsonForm,
)
from django.urls import reverse, reverse_lazy