Re: Django and uuid with PostgreSQL

2016-10-18 Thread Andrea Posi
Yes, it is actually correct, but I'd just like to force uuid generation at database level (postgres supports it) and not via python/django I can modify the table with raw sql after migration and disable default=uuid.uuid4 inside django models, but I'm looking for a better way to accomplish it Il

Re: Django and uuid with PostgreSQL

2016-10-18 Thread Tim Graham
The SQL looks correct -- it's not using anything Python related. Are you encountering some error? On Tuesday, October 18, 2016 at 9:15:46 AM UTC-4, Andrea Posi wrote: > > 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 mode

Django and uuid with PostgreSQL

2016-10-18 Thread Andrea Posi
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: class AbstractGuidModel(models.Model): uuid = models.UUIDField(blank=True, default=uuid.uuid4, unique=True, editable=False) class Meta: