You could just explicitly claim the 'id' field in your model, assign a
desired type.

If you want a model that has the default primary key as UUID for future
use, you could write a customized class inherited from models.Model,
overriding the 'id' field.

I don't feel like this is something needed to be integrated into the
official code.

See Automation Primary Key Fields:
https://docs.djangoproject.com/en/1.10/topics/db/models/#automatic-primary-key-fields


Best regards,
Ares Ou

*Software Engineer / Full-Stack Python Developer  |  **Phone:* (510) 328 -
5968

*Blog:* http://aresou.net  |  *Github:* https://github.com/aresowj  |  *Stack
Overflow:* http://stackoverflow.com/users/5183727/ares-ou

Ares Ou

On Tue, Aug 30, 2016 at 11:43 AM, Tim Graham <[email protected]> wrote:

> Sounds quite complicated. In particular, how could we reasonably test that
> contrib apps work with arbitrary PKs?
>
> On Tuesday, August 30, 2016 at 2:32:18 PM UTC-4, Emett Speer wrote:
>>
>> Hello Everyone,
>>
>> I would like to propose the exploration of adding a default PK setting do
>> Django. This could be a flag at project creation time or a setting to be
>> set before the first migration takes place.
>>
>> This would allow the developer to set the default PK in Django to
>> something like UUID. With this things like the default Group, User, etc..
>> models would have UUID based PK's rather then Int based ones and all future
>> tables would have UUID PK's by default.
>>
>> Please let me know what you think.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/01763b34-8970-47a4-950e-
> 04343e717514%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/01763b34-8970-47a4-950e-04343e717514%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFCGC%3Db7foiZCz1VwTYPaJGpUgUWbxfyHYEKO%3Dq7a6iUg8Nraw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to