誰が私を説明できますか?(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