Yes it is and very easy.
Create a form without a username field and do something like this:
def autogenerate_username ():
# some logic
new_user=User.objects.create_user(autogenerate_username (),
self.cleaned_data['email'],
self.cleaned_data['password1'])
new_user.first_name = self.cleaned_data['first_name']
new_user.last_name = self.cleaned_data['last_name']
new_user.save()
On 1 May 2015 01:48, <emek...@gmail.com> wrote:
>
> Hi there -
> I’m in the process of building a site with django, and I noticed that username is a requirement for the django registration app. I’m wondering if it’s possible to auto generate the username after the user make entries in the other fields (i.e. name, city, email, password)?
>
> OR does django registration necessarily require the username to be created at the same time as the other fields?
>
> thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/26e45341-aa13-4404-9f42-c3c38061b753%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.