Hi i'm working with django and on my project i need to create users that have privileges, right now i'm doing this:
def signAdmin(request):
if request.method == 'POST':
user_form = UserCreationForm(request.POST)
if user_form.is_valid():
username = user_form.cleaned_data['username']
user_form.save()
user = User.objects.get(username=username)
user.is_staff = True
return HttpResponseRedirect('/login')
else:
user_form = UserCreationForm()
return render_to_response(
'register.html',
{
'user_form': user_form
},
context_instance=RequestContext(request)
)
but doesn't work, I've tried a few things but they have not worked for me, could you tell me how to do this? thank you.