I'm creating a rest api using Django and DRF. I don't want to expose IDs
directly to clients so I'm trying to setup my models like this example:
uuid = models.UUIDField(blank=True, default=uuid.uuid4, unique=True,
abstract = True
name = models.CharField(max_length=NAME_LENGTH)
Since the AbstractGuidModel has default=uuid.uuid4, uuid are generated by
python code and migrations look like:
CREATE TABLE "MyModel" ( ... "uuid" uuid NOT NULL UNIQUE, ... );
I've read Postgres has an extension for generating automatically uuids.
Once extension is installed, how can I tell django to let database use his
own extension and not letting him create them with the Python uuid module?
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 post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.