import uuid uuid.uuid4().hex[:8] or
from django.utils.crypto import get_random_string get_random_string(8).lower() def get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'): On Mon, Jan 20, 2020 at 2:31 PM Soumen Khatua <soumenkhatua...@gmail.com> wrote: > Hi Folks, > > I want to generate unique 6 digit primary key for django models and I want > to generate this for 10 billon users. So guys please could you tell me How > I can do that? > > I tried UUID module but it's generating some big numbers. > > Thank you > > Regards, > Soumen > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPUw6WZSz%3D0sPRJ40VTVHQRD8GtHh3m2zb64Te4ti8RF2f23Vg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAPUw6WZSz%3D0sPRJ40VTVHQRD8GtHh3m2zb64Te4ti8RF2f23Vg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADwyzwo6LUiedx4b%3D0T9mEn%3DurULxfy%2BYvOMMXKeUMZyX0TfLw%40mail.gmail.com.