def dispatch(self, request, *args, **kwargs):
'''
Can only add contract types in own gym
'''
if not request.user.is_authenticated():
return HttpResponseForbidden()
if request.user.userprofile.gym_id != int(self.kwargs['gym_pk']):
return HttpResponseForbidden()
return super(AddView, self).dispatch(request, *args, **kwargs)
评论列表
文章目录