谁能解释一下,是什么(User, 'username', 'username')
意思(User, 'username', 'username', 'groups__name', 'group_name')
?
@permission_required('auth.change_user', return_403=True)
def my_view(request):
return HttpResponse('Hello')
@permission_required('auth.change_user', (User, 'username', 'username'))
def my_view(request, username):
user = get_object_or_404(User, username=username)
return user.get_absolute_url()
@permission_required('auth.change_user',
(User, 'username', 'username', 'groups__name', 'group_name'))
def my_view(request, username, group_name):
user = get_object_or_404(User, username=username,
group__name=group_name)
return user.get_absolute_url()
在这里拍摄:http: //pythonhosted.org/django-guardian/api/guardian.decorators.html