Hello all, The previous discussion shows a method that will work. but I think it has disadvantages, and I want to suggest another approach.
The disadvantage of using a primary key from a table, any table, is that you are committing to that table and that primary key for all eternity. this has consequences for migration to another system , for merging in data from an external system, among others. Joel, if I understand your situation, you have a "thing", an individual human being, and you need a permanent, unique identifier for that "thing". The identifier should not be an implementation detail of your current code, but should be robust, sharable, and resilient in the face of evolving software. I faced a similar situation with digital assets that are photos and videos. We share photos and videos across several related sites, but we don't want to duplicate the asset for each site. My solution is to generate a UUID, a Universally Unique IDentifier, when creating the "thing" - see python 3 at https://docs.python.org/3/library/uuid.html. or python 2 at https://docs.python.org/2/library/uuid.html. A Universally Unique IDentifier is guaranteed not to collide with any other UUID, and so independent systems can generate one at any time - no need to coordinate with a central database or across separate servers. A UUID is robust in the face of name changes - such as a maiden name becoming a married name. I would recommend a UUID over exposing a primary key, hands down, all the time, no exceptions. -- Bill -- 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/8bcbd562-5bb8-49f3-b1ad-1b73ff62d840%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.