Primary Key AutoField -> UUID Field

2020-11-14 Thread Brian Carter
Feature Request: I like to use the UUIDField as the primary key in my models, and I think it would be nice to have django expose a setting in the settings.py to override the default primary key on models. Currently, if I don’t specify a field as the primary key, Django automatically uses an A

Re: Primary Key AutoField -> UUID Field

2020-11-14 Thread אורי
Hi Brian, In Speedy Net we use a randomly generated string of digits, either 15 digits or 20 digits, as a primary key in all our models. We never use auto-incrementing integers as primary keys. You can take a look at our implementation, especially class *BaseModel* which is the base class for all

Re: Primary Key AutoField -> UUID Field

2020-11-14 Thread Tom Forbes
Uri, I would definitely suggest using an actual UUID rather than rolling your own ad-hoc UUID implementation, even if your database does not support a native UUID type. Brian, there is some work ongoing that should make this possible. We will add a setting to control the type of the auto-create

Re: Primary Key AutoField -> UUID Field

2020-11-14 Thread Tim Graham
Hi Brian, There are existing threads about that (try searching the archives for 'default pk' to find some of them). Here's a PR that adds the setting you described: https://github.com/django/django/pull/13179. Perhaps you would like to try it out and see if it meets your needs. On Saturday, Nov

Re: Primary Key AutoField -> UUID Field

2020-11-14 Thread David Nugent
> On 20201115, at 09:47, Tim Graham wrote: > > Hi Brian, There are existing threads about that (try searching the archives > for 'default pk' to find some of them). Here's a PR that adds the setting you > described: https://github.com/django/django/pull/13179. Perhaps you would > like to try