diff --git a/rowers/forms.py b/rowers/forms.py index 20882308..530c842d 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -1404,6 +1404,7 @@ class FlexAxesForm(forms.Form): extrametrics = kwargs.pop('extrametrics',[]) super(FlexAxesForm, self).__init__(*args, **kwargs) + rower = Rower.objects.get(user=request.user) axchoicespro = ( diff --git a/rowers/tests/viewnames.csv b/rowers/tests/viewnames.csv index e20afca6..50f70e99 100644 --- a/rowers/tests/viewnames.csv +++ b/rowers/tests/viewnames.csv @@ -149,18 +149,18 @@ 148,188,coach_accept_coachrequest_view,Accept Coach request,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 149,189,rower_accept_coachoffer_view,Accept Coach offer,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 150,190,team_delete_view,Delete Team,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -151,191,team_create_view,Create Team,TRUE,302,pro,302,302,FALSE,200,200,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, +151,191,team_create_view,Create Team,TRUE,302,pro,302,302,FALSE,200,200,FALSE,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, 152,192,manager_member_drop_view,Drop member,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 153,193,invitation_reject_view,Reject invitation,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 154,194,invitation_revoke_view,redirects when no invitations,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -155,195,rower_invitations_view,See Invitations,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, +155,195,rower_invitations_view,See Invitations,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, 156,196,raise_500,Test 500 error,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 157,198,request_revoke_view,redirects when no invitations,TRUE,302,basic,302,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 158,199,request_reject_view,rejects request,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 159,200,manager_requests_view,views requests,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -160,202,rower_edit_view,edit rower preferences,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, -161,204,rower_prefs_view,edit more preferences,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, -162,205,transactions_view,view transactions (staff only),TRUE,302,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE, +160,202,rower_edit_view,edit rower preferences,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, +161,204,rower_prefs_view,edit more preferences,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, +162,205,transactions_view,view transactions (staff only),TRUE,302,basic,200,302,basic,200,302,coach,200,302,TRUE,FALSE,FALSE,FALSE,TRUE, 163,208,rower_c2_authorize,redirects to C2 auth page,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 164,209,rower_polar_authorize,redirects to Polar,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 165,210,rower_revokeapp_view,revoke app,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, @@ -173,11 +173,11 @@ 172,217,rower_underarmour_token_refresh,refresh token,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 173,218,rower_tp_token_refresh,refresh token,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 174,219,rower_c2_token_refresh,refresh token,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -175,220,rower_favoritecharts_view,See favorite charts,TRUE,302,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, +175,220,rower_favoritecharts_view,See favorite charts,TRUE,302,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, 176,222,workout_workflow_config2_view,configure workflow,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE, -177,224,workflow_default_view,resets workflow to default,TRUE,302,basic,302,302,FALSE,403,403,FALSE,302,403,FALSE,FALSE,FALSE,TRUE,TRUE, -178,225,sendmail,feedback form,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, -180,232,laboratory_view,lab,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, +177,224,workflow_default_view,resets workflow to default,TRUE,302,basic,302,302,FALSE,403,403,FALSE,302,403,FALSE,FALSE,FALSE,FALSE,TRUE, +178,225,sendmail,feedback form,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, +180,232,laboratory_view,lab,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, 181,233,errormessage_view,not used,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 182,237,payment_confirm_view,confirm payment,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 183,238,upgrade_confirm_view,confirm upgrade,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, @@ -187,53 +187,53 @@ 187,243,downgrade_view,confirm downgrade,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 188,244,payment_completed_view,payment completed,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 189,245,downgrade_completed_view,downgrade completed,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -190,246,paidplans_view,paid plans,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, +190,246,paidplans_view,paid plans,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, 191,247,plan_stop_view,stop plan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 192,248,plan_tobasic_view,reset to basic,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 193,249,checkouts_view,checkout,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 194,250,upgrade_checkouts_view,upgrade checkout,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 195,251,downgrade_checkouts_view,downgrade checkout,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -196,252,planrequired_view,a plan is required,TRUE,302,basic,302,302,basic,302,302,coach,302,302,FALSE,FALSE,FALSE,TRUE,TRUE, +196,252,planrequired_view,a plan is required,TRUE,302,basic,302,302,basic,302,302,coach,302,302,FALSE,FALSE,FALSE,FALSE,TRUE, 197,253,start_trial_view,payments,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 198,254,start_plantrial_view,paid plans,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -199,256,rower_register_view,register rower,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, -200,257,freecoach_register_view,register coach,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE, -201,259,workout_workflow_view,workout workflow vieq,TRUE,200,basic,200,200,basic,200,200,coach,200,200,FALSE,FALSE,TRUE,TRUE,TRUE, -202,260,workout_flexchart3_view,flex chart,TRUE,200,basic,200,403,basic,200,200,coach,200,200,FALSE,FALSE,TRUE,TRUE,TRUE, +199,256,rower_register_view,register rower,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, +200,257,freecoach_register_view,register coach,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, +201,259,workout_workflow_view,workout workflow vieq,TRUE,302,basic,200,200,basic,200,200,coach,200,200,FALSE,FALSE,TRUE,FALSE,TRUE, +202,260,workout_flexchart3_view,flex chart,TRUE,302,basic,200,403,basic,200,200,coach,200,200,FALSE,FALSE,TRUE,FALSE,TRUE, 203,264,rower_process_testcallback,test callback,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -204,265,rower_create_trainingplan,create training plan,TRUE,302,plan,200,302,FALSE,403,403,FALSE,200,403,FALSE,FALSE,FALSE,TRUE,TRUE, +204,265,rower_create_trainingplan,create training plan,TRUE,302,plan,200,302,FALSE,403,403,FALSE,200,403,FALSE,FALSE,FALSE,FALSE,TRUE, 205,267,TrainingPlanDelete,delete training plan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 206,268,MicroCycleDelete,delete training plan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 207,269,MesoCycleDelete,delete training plan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 208,270,MacroCycleDelete,delete training plan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -209,271,rower_trainingplan_view,see training plan,TRUE,200,plan,200,302,plan,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, -210,279,rower_trainingplan_execution_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -211,281,TrainingMacroCycleUpdate,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -212,282,TrainingMesoCycleUpdate,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -213,283,planmacrocyclebymonth,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -214,285,planmesocyclebyweek,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -215,287,TrainingMicroCycleUpdate,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -216,288,rower_delete_trainingtarget,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -217,289,TrainingPlanUpdate,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -218,290,TrainingTargetUpdate,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -219,291,strokedataform,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -220,292,plannedsession_teamcreate_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -221,296,plannedsession_teamedit_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -222,298,plannedsession_create_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -223,300,plannedsession_multiclone_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -224,302,plannedsession_multicreate_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -225,305,plannedsession_edit_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -226,306,plannedsession_totemplate_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -227,307,plannedsession_compare_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -228,310,plannedsession_clone_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -229,311,plannedsession_teamclone_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -230,313,plannedsession_detach_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -231,315,plannedsession_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -232,317,PlannedSessionDelete,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, -233,319,plannedsessions_manage_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -234,323,plannedsessions_coach_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -235,325,plannedsessions_coach_icsemail_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -236,326,plannedsessions_print_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, +209,271,rower_trainingplan_view,see training plan,TRUE,200,plan,200,302,plan,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE, +210,279,rower_trainingplan_execution_view,see training plan execution,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +211,281,TrainingMacroCycleUpdate,update macro cycle,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +212,282,TrainingMesoCycleUpdate,update cycle,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +213,283,planmacrocyclebymonth,update cycle,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +214,285,planmesocyclebyweek,plan meso by week,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +215,287,TrainingMicroCycleUpdate,update cycle,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +216,288,rower_delete_trainingtarget,delete training target,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +217,289,TrainingPlanUpdate,update trainingplan,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +218,290,TrainingTargetUpdate,update training target,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +219,291,strokedataform,test strokedata,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +220,292,plannedsession_teamcreate_view,create planned session for team,TRUE,302,coach,200,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,FALSE,TRUE, +221,296,plannedsession_teamedit_view,edit planned sesssion,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +222,298,plannedsession_create_view,create planned session ,TRUE,302,plan,200,302,FALSE,200,302,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, +223,300,plannedsession_multiclone_view,clone multiple planned sessions,TRUE,302,plan,200,302,plan,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, +224,302,plannedsession_multicreate_view,create multiple planned sessions,TRUE,302,plan,200,302,plan,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,TRUE, +225,305,plannedsession_edit_view,edit planned sesssion,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +226,306,plannedsession_totemplate_view,planned session to template,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +227,307,plannedsession_compare_view,compare workouts from planned session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +228,310,plannedsession_clone_view,clone planned session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +229,311,plannedsession_teamclone_view,clone team planned session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +230,313,plannedsession_detach_view,remove workout from session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +231,315,plannedsession_view,view session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +232,317,PlannedSessionDelete,delete session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, +233,319,plannedsessions_manage_view,manage planned sesions,TRUE,302,plan,200,302,plan,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, +234,323,plannedsessions_coach_view,team view,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, +235,325,plannedsessions_coach_icsemail_view,team view,TRUE,302,coach,302,403,coach,302,403,coach,302,403,FALSE,TRUE,FALSE,TRUE,TRUE, +236,326,plannedsessions_print_view,print view,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, 237,327,plannedsession_comment_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 238,330,plannedsessions_icsemail_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, 239,332,plannedsessions_view,,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, diff --git a/rowers/urls.py b/rowers/urls.py index ca7c045d..00b83ac9 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -524,7 +524,7 @@ urlpatterns = [ re_path(r'^me/tprefresh/$',views.rower_tp_token_refresh,name='rower_tp_token_refresh'), re_path(r'^me/c2refresh/$',views.rower_c2_token_refresh,name='rower_c2_token_refresh'), re_path(r'^me/favoritecharts/$',views.rower_favoritecharts_view,name='rower_favoritecharts_view'), - re_path(r'^me/favoritecharts/user/(?P\d+)/$',views.rower_favoritecharts_view,name='rower_favoritecharts_view'), + re_path(r'^me/favoritecharts/user/(?P\d+)/$',views.rower_favoritecharts_view,name='rower_favoritecharts_view'), # re_path(r'^me/workflowconfig/$',views.workout_workflow_config_view), re_path(r'^me/workflowconfig2/$',views.workout_workflow_config2_view,name='workout_workflow_config2_view'), re_path(r'^me/workflowconfig2/user/(?P\d+)/$',views.workout_workflow_config2_view,name='workout_workflow_config2_view'), @@ -539,8 +539,8 @@ urlpatterns = [ # re_path(r'^compatibility', TemplateView.as_view(template_name='compatibility.html'),name='about'), # re_path(r'^videos', TemplateView.as_view(template_name='videos.html'),name='videos'), re_path(r'^analysis/user/(?P\d+)/$', views.analysis_view,name='analysis'), - re_path(r'^laboratory/$', views.laboratory_view,name='laboratory'), - re_path(r'^laboratory/user/(?P\d+)/$', views.laboratory_view,name='laboratory'), + re_path(r'^laboratory/$', views.laboratory_view,name='laboratory_view'), + re_path(r'^laboratory/user/(?P\d+)/$', views.laboratory_view,name='laboratory_view'), re_path(r'^errormessage/(?P[\w\ ]+.*)/$',views.errormessage_view,name='errormessage_view'), re_path(r'^analysis/$', views.analysis_view,name='analysis'), re_path(r'^promembership', TemplateView.as_view(template_name='promembership.html'),name='promembership'), @@ -553,7 +553,7 @@ urlpatterns = [ re_path(r'^downgrade/$',views.downgrade_view,name='downgrade'), re_path(r'^paymentcompleted/$',views.payment_completed_view,name='payment_completed_view'), re_path(r'^downgradecompleted/$',views.downgrade_completed_view,name='downgrade_completed_view'), - re_path(r'^paidplans/$',views.paidplans_view,name='paidplans'), + re_path(r'^paidplans/$',views.paidplans_view,name='paidplans_view'), re_path(r'^me/cancelsubscriptions/$',views.plan_stop_view,name='plan_stop_view'), re_path(r'^me/cancelsubscription/(?P[\w\ ]+.*)/$',views.plan_tobasic_view,name='plan_tobasic_view'), re_path(r'^checkouts/$',views.checkouts_view,name='checkouts'), @@ -657,7 +657,7 @@ urlpatterns = [ # re_path(r'^sessions/create/(?P\d+-\d+-\d+)/(?P\d+-\d+-\d+)/user/(?P\d+)/$', # views.plannedsession_create_view, # name='plannedsession_create_view'), - re_path(r'^sessions/multiclone/$',views.plannedsession_multiclone_view), + re_path(r'^sessions/multiclone/$',views.plannedsession_multiclone_view,name='plannedsession_multiclone_view'), re_path(r'^sessions/multiclone/user/(?P\d+)/$', views.plannedsession_multiclone_view, name='plannedsession_multiclone_view'), @@ -721,7 +721,7 @@ urlpatterns = [ re_path(r'^sessions/print/user/(?P\d+)/$',views.plannedsessions_print_view, name='plannedsessions_print_view'), re_path(r'^sessions/sendcalendar/$',views.plannedsessions_icsemail_view, - name='plannedsessions_icsemail_view'), + name='plannedsessions_coach_icsemail_view'), re_path(r'^sessions/sendcalendar/user/(?P\d+)/$',views.plannedsessions_icsemail_view, name='plannedsessions_icsemail_view'), re_path(r'^sessions/$',views.plannedsessions_view, diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index 6d09525e..d493f6b5 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -1330,7 +1330,7 @@ def cum_flex(request,theuser=0, def planrequired_view(request): messages.info(request,"This functionality requires Coach or Self-Coach membership") - return HttpResponseRedirect(reverse('paidplans')) + return HttpResponseRedirect(reverse('paidplans_view')) @user_passes_test(isplanmember,login_url="/rowers/paidplans", message="This functionality requires a Coach or Self-Coach plan", diff --git a/rowers/views/otherviews.py b/rowers/views/otherviews.py index f0813448..aa28d89b 100644 --- a/rowers/views/otherviews.py +++ b/rowers/views/otherviews.py @@ -77,6 +77,7 @@ def errormessage_view(request,errormessage='aap'): # Shows analysis page @login_required() +@permission_required('rower.is_coach',fn=get_user_by_userid,raise_exception=True) def analysis_view(request,userid=0): r = getrequestrower(request,userid=userid) return render(request, @@ -89,6 +90,7 @@ def analysis_view(request,userid=0): # Shows laboratory page @login_required() +@permission_required('rower.is_coach',fn=get_user_by_userid,raise_exception=True) def laboratory_view(request,userid=0): r = getrequestrower(request,userid=userid) return render(request, diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py index b5ec6dad..034a1ba9 100644 --- a/rowers/views/planviews.py +++ b/rowers/views/planviews.py @@ -1216,6 +1216,7 @@ def plannedsessions_print_view(request,userid=0): @login_required() +@permission_required('rower.is_coach',fn=get_user_by_userid,raise_exception=True) def plannedsessions_manage_view(request,userid=0, initialsession=0): diff --git a/rowers/views/statements.py b/rowers/views/statements.py index e6a6e7e6..c011da93 100644 --- a/rowers/views/statements.py +++ b/rowers/views/statements.py @@ -385,6 +385,8 @@ def getrequestrower(request,rowerid=0,userid=0,notpermanent=False): elif userid != 0: u = User.objects.get(id=userid) r = getrower(u) + elif request.user.is_anonymous: + return None else: r = getrower(request.user) u = r.user diff --git a/rowers/views/teamviews.py b/rowers/views/teamviews.py index 7fda180c..16a8cc60 100644 --- a/rowers/views/teamviews.py +++ b/rowers/views/teamviews.py @@ -442,7 +442,7 @@ def team_requestmembership_view(request,teamid,userid): messages.error(request, "You have to be on a paid plan (Pro or higher) to join this team. As a basic user you can only join teams managed by users on the Coach plan.") - url = reverse('paidplans') + url = reverse('paidplans_view') return HttpResponseRedirect(url) res,text = teams.create_request(t,userid) @@ -669,7 +669,7 @@ def team_create_view(request): if not res: messages.error(request,message) - url = reverse('paidplans') + url = reverse('paidplans_view') return HttpResponseRedirect(url) url = reverse('rower_teams_view') diff --git a/rowers/views/userviews.py b/rowers/views/userviews.py index 9d39feef..c38422ab 100644 --- a/rowers/views/userviews.py +++ b/rowers/views/userviews.py @@ -215,11 +215,11 @@ def start_plantrial_view(request): # Page where user can manage his favorite charts @login_required() -@permission_required('rower.is_coach',fn=get_user_by_id,raise_exception=True) -def rower_favoritecharts_view(request,id=0): +@permission_required('rower.is_coach',fn=get_user_by_userid,raise_exception=True) +def rower_favoritecharts_view(request,userid=0): message = '' successmessage = '' - r = getrequestrower(request,userid=id,notpermanent=True) + r = getrequestrower(request,userid=userid,notpermanent=True) favorites = FavoriteChart.objects.filter(user=r).order_by('id') aantal = len(favorites) favorites_data = [{'yparam1':f.yparam1, diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 587974e5..ab64ca8b 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -3283,7 +3283,7 @@ def workout_workflow_config2_view(request,userid=0): # Workflow View -#@login_required() +@login_required() @permission_required('workout.view_workout',fn=get_workout_by_opaqueid,raise_exception=True) def workout_workflow_view(request,id): request.session['referer'] = absolute(request)['PATH'] @@ -3371,6 +3371,7 @@ def workout_workflow_view(request,id): }) # The famous flex chart +@login_required() @permission_required('workout.view_workout',fn=get_workout_by_opaqueid,raise_exception=True) def workout_flexchart3_view(request,*args,**kwargs): @@ -3390,11 +3391,11 @@ def workout_flexchart3_view(request,*args,**kwargs): favoritenr = -1 row = get_workout(id) + r = getrequestrower(request) promember=0 mayedit=0 if not request.user.is_anonymous: - r = getrower(request.user) result = ispromember(request.user) if result: promember=1 @@ -3898,7 +3899,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""): data = getsmallrowdata_db(['wash'],ids=[encoder.decode_hex(id)]) try: if data['wash'].std() != 0: - url = reverse('paidplans') + url = reverse('paidplans_view') messages.info( request, 'Some Empower Oarlock data are only available to users with a paid plan'.format(u=url)