#24631: UUIDField makemigration error
----------------------------+-----------------------
Reporter: muhamada | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords: migration
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+-----------------------
As I'm using UUIDField to generate a primary key, when I make migration it
returns the following
{{{
ValueError: Cannot serialize: UUID('613d3463-b9d6-4bf1-9b62-1e31598b2700')
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/1.8/topics/migrations
/#migration-serializing
}}}
Using the following in models.py
{{{
from uuid import uuid4
uuid = models.UUIDField(primary_key=True, default=uuid4(), editable=False)
}}}
I managed to make this work by using default=uuid4().hex but the value in
the migration file is that generated value
--
Ticket URL: <https://code.djangoproject.com/ticket/24631>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.f34b1fbaa4f0903763ef43189456ed2f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.