> On 20201115, at 09:47, Tim Graham <timogra...@gmail.com> 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 it out and see if it meets your needs.

Agree - there are aspects of a UUID that avoid collisions with a far lesser 
probability than an arbitrary random value.

I use this:

from django.db import models
import uuid


class SomeModel(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    ...

As already mentioned, using abstract models for this is also useful, helps with 
DRY.

/d


-- 
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 django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/38A8AB58-9299-48D0-8F50-50778486C822%40gmail.com.

Reply via email to