> > So my question is, can I make this random ID the primary key of the User model? I don't want users to have 2 ids - one for Django and one of Speedy Net, it doesn't make sense. I want the id to be the same and unique. I also want to have an Id model to prevent a page and a user (for example) to have the same ID. And a Username model to prevent them from having the same username. Is it possible to do it with Django 1.9.2? >
Rather than coming up with some arbitrary numbering scheme that will be difficult to manage, you should really just be using a UUID field, which provides the same benefits and can be used as the PK quite easily. Projects with large numbers of rows often go this route, since there is effectively an unlimited number of UUID's. https://docs.djangoproject.com/en/1.9/ref/models/fields/#uuidfield If you can, use Postgres as your backend DB, since it has native support for UUID's, other DB's will simply treat them as CharFields, which will still work but is slightly less efficient. -James -- 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 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/CA%2Be%2BciV-O_LLcZ86rpT3_VbHM8aLXDLjocVw92SHtUuCg43wAA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.