I want username field is automatically filled with this value:
username = str(n);
where n is a number (autoincremented or random).
I tried to add this in save method:
username = str(random.randint(0,1000000)
but there is a collision problem when n is the same for 2 users.
How do I do this ?
Generate it
username = str(random.randint(0,1000000)and check for a user with such a name
User.objects.get(username=username)if you find someone, generate a new one.