> i want to create superuser(administrator) on registration.... User.objects.create_superuser is your friend.
> user=User.objects.create_user( > username=form.cleaned_data['username'], > password=form.cleaned_data['password1'], > email=form.cleaned_data['email'], > is_staff=form.cleaned_data['is_staff'], > ) Maybe try instead: user=User.objects.create_superuser( username=form.cleaned_data['username'], password=form.cleaned_data['password1'], email=form.cleaned_data['email'], ) Kenny On Thu, Jun 16, 2011 at 12:03 PM, ashish tiwari <ashish...@gmail.com> wrote: > hi friends, > i developed an application in django-nonrel with appengine. > i'm using django forms for user registration. > > forms.py > ~~~~~~~~ > class RegistrationForm(forms.Form): > username=forms.CharField(label=u'Username',max_length=30) > email=forms.CharField(label=u'Email') > is_staff=forms.BooleanField(label=u'is staff') > > password1=forms.CharField(label=u'Password',widget=forms.PasswordInput()) > > password2=forms.CharField(label=u'Password(Again)',widget=forms.PasswordInput()) > views.py > ~~~~~~~~ > def register_page(request): > if request.method=='POST': > form = RegistrationForm(request.POST) > if form.is_valid(): > user=User.objects.create_user( > username=form.cleaned_data['username'], > password=form.cleaned_data['password1'], > email=form.cleaned_data['email'], > is_staff=form.cleaned_data['is_staff'], > ) > return HttpResponseRedirect('/') > else: > form=RegistrationForm() > variables=RequestContext(request,{'form':form}) > return > render_to_response('interview/registration/register.html',variables) > > register.html > ~~~~~~~~~ > <form method="post" action="."> > {{ form.as_p }} > <input type="submit" value="register" /> > when i try to register,it throws an error .. > "create_user() got an unexpected keyword argument 'is_staff'" > i want to create superuser(administrator) on registration.... is there > anything m doing wrong? Thanks in advance.... > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/4HkVMVqNkJwJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.