basic users can now see alerts created by their coaches
This commit is contained in:
@@ -4322,9 +4322,10 @@ def agegrouprecordview(request,sex='male',weightcategory='hwt',
|
||||
})
|
||||
|
||||
# alert overview view
|
||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
||||
redirect_field_name=None)
|
||||
#@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||
# message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
||||
# redirect_field_name=None)
|
||||
@login_required
|
||||
def alerts_view(request,userid=0):
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
@@ -4436,9 +4437,7 @@ def alert_create_view(request,userid=0):
|
||||
})
|
||||
|
||||
# alert report view
|
||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
||||
redirect_field_name=None)
|
||||
@login_required()
|
||||
def alert_report_view(request,id=0,userid=0,nperiod=0):
|
||||
r = getrequestrower(request,userid=userid)
|
||||
if userid == 0:
|
||||
@@ -4505,7 +4504,7 @@ def alert_edit_view(request,id=0,userid=0):
|
||||
raise Http404("This alert doesn't exist")
|
||||
|
||||
|
||||
if alert.manager != request.user:
|
||||
if not alert.manager != request.user:
|
||||
raise PermissionDenied('You are not allowed to edit this Alert')
|
||||
|
||||
FilterFormSet = formset_factory(ConditionEditForm, formset=BaseConditionFormSet,extra=0)
|
||||
@@ -4603,6 +4602,7 @@ def alert_edit_view(request,id=0,userid=0):
|
||||
})
|
||||
|
||||
# alert delete view
|
||||
|
||||
class AlertDelete(DeleteView):
|
||||
login_requird = True
|
||||
model = Alert
|
||||
@@ -4650,6 +4650,9 @@ class AlertDelete(DeleteView):
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super(AlertDelete, self).get_object(*args, **kwargs)
|
||||
|
||||
if obj.manager != self.request.user:
|
||||
raise PermissionDenied("You are not allowed to delete this Alert")
|
||||
|
||||
# some checks
|
||||
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user