GeekyCoder
GeekyCoder

Reputation: 67

Django: Create a random username

I'm using this hack to create a custom user model but I don't want when users have been signed in their emails to be displayed so I have another field called display_name where users get to choose what kind of name they want displayed. For this when a new users signs up I would like to generate a display name using his/her email with the part before @ symbol, this can be changed later if the user chooses to do so. My question is how would I go on to do this.

Upvotes: 0

Views: 172

Answers (1)

catavaran
catavaran

Reputation: 45575

display_name = email.split('@')[0]

Upvotes: 2

Related Questions