The database usually handles this and you don't need to worry, there are many corner cases and DB systems are able to handle them
But they won't look like whatever format you would like, usually it is just a number
Why do you need the IDs to look like that?
On Oct 22, 2017 6:53 PM, "Jack Zhang" <valachio123@gmail.com> wrote:
Let's say I have a model called 'Dogs'. Users can create instances of Dogs. For every Dogs instance that is created, I want to assign a globally unique ID to it. The ID will be 3 capitalized letters followed by 7 numbers. E.g. ABC1234567, POZ2930193--What is the easiest way to go about doing this? I looked into UUID but it generates a longer string. Keep in mind that the ID must be globally unique - so after one has been created, it should not be created again.Thanks.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0cd8e33c- .8c92-471c-9c36-ac82749750b4% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6t%2B6p-zRLv1Op_ipmZvi1M1HAeEx%2B5ZMR_BN78kGBi%3DuCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment