anonymous user cannot save favorite
This commit is contained in:
@@ -260,8 +260,12 @@ from utils import geo_distance,serialize_list,deserialize_list
|
||||
|
||||
# Check if a user is a Coach member
|
||||
def iscoachmember(user):
|
||||
r = Rower.objects.get(user=user)
|
||||
result = user.is_authenticated() and (r.rowerplan=='coach')
|
||||
if not user.is_anonymous():
|
||||
r = Rower.objects.get(user=user)
|
||||
result = user.is_authenticated() and (r.rowerplan=='coach')
|
||||
else:
|
||||
result = False
|
||||
|
||||
return result
|
||||
|
||||
# Check if a user is a Pro member
|
||||
@@ -4198,14 +4202,15 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
||||
workstrokesonly = False
|
||||
|
||||
if request.method == 'POST' and 'savefavorite' in request.POST:
|
||||
workstrokesonly = request.POST['workstrokesonlysave']
|
||||
reststrokes = not workstrokesonly
|
||||
r = Rower.objects.get(user=request.user)
|
||||
f = FavoriteChart(user=r,xparam=xparam,
|
||||
yparam1=yparam1,yparam2=yparam2,
|
||||
plottype=plottype,workouttype=workouttype,
|
||||
reststrokes=reststrokes)
|
||||
f.save()
|
||||
if not user.is_anonymous():
|
||||
workstrokesonly = request.POST['workstrokesonlysave']
|
||||
reststrokes = not workstrokesonly
|
||||
r = Rower.objects.get(user=request.user)
|
||||
f = FavoriteChart(user=r,xparam=xparam,
|
||||
yparam1=yparam1,yparam2=yparam2,
|
||||
plottype=plottype,workouttype=workouttype,
|
||||
reststrokes=reststrokes)
|
||||
f.save()
|
||||
|
||||
if request.method == 'POST' and 'workstrokesonly' in request.POST:
|
||||
workstrokesonly = request.POST['workstrokesonly']
|
||||
|
||||
Reference in New Issue
Block a user