Home:ALL Converter>Django auto generate identifier number

Django auto generate identifier number

Ask Time:2017-02-02T17:50:51         Author:Karesh A

Json Formatter

I want to define the unique identifier field for the Django user model. I want the numbers like 0000-0000-0001, 0000-0000-0002 when save the models.

Approach: I can define field as char and post_save signal can update the identifier based on primary key.

Is there any automatic way to generate number like this for the user identifier (not primary key)

Author:Karesh A,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41998935/django-auto-generate-identifier-number
yy