Hey guys when registering users I only want them to be able to use names starting with @ I have been looking in documentation for Django all day but don't seem to be able to find where I could edit this. Any help would be awesome thank you!
Asked
Active
Viewed 58 times
0
-
3If all usernames start with an `@` you don't need to store it. – Klaus D. Jan 26 '20 at 05:06
-
Take a look at the models on Speedy Net [https://github.com/speedy-net/speedy-net/blob/master/speedy/core/accounts/models.py] and see how fields are validated (search for "validators"). But, is "@" part of the username? Because you can just save the username after the "@" without saving the "@" character to the database. – Uri Jan 26 '20 at 14:23
1 Answers
0
Write a custom user manager. And overwrite create_user and create_superuser methods according to your needs. Then use these methods for creating users.
Also you might want to read User manager methods create() and create_user().
Dipen Dadhaniya
- 4,550
- 2
- 16
- 24