I am using Django Rest framework for my application. I almost implemented registration and login process using django User Model without customizing it now i want to add a uuid field in it. Is there any way we can just add uuid field and other process remains same?
Asked
Active
Viewed 3,429 times
2
-
Take a look here: https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html#abstractuser – jape Nov 24 '17 at 18:33
1 Answers
6
Adding UUIDField to existing models is not so easy but you can read an How-To in the official Django documentation in the specific section (I updated it few months ago) :

Paolo Melchiorre
- 5,716
- 1
- 33
- 52
-
I went through the steps and it all worked ok except whenever I run makemigrations I get `Alter field uuid on mymodel` ? – Josh Apr 24 '19 at 09:44
-
What's your question ? Can you write clearly your question or better can you open a new question because is not related to this original question. – Paolo Melchiorre Apr 24 '19 at 10:08
-
Every time I run migrations it thinks I have altered the field. This is the migrations statement "- Alter field qrcode on profile" where qrcode is my uuid object and profile is the model – Josh Apr 24 '19 at 10:24
-
Sorry figured it out. My django model was `default=uuid.uuid4()` instead of `default=uuid.uuid4` – Josh Apr 24 '19 at 10:35
-
Ok. If you found useful this answer maybe you can vote for it thanks. – Paolo Melchiorre Apr 24 '19 at 12:05