#25794: loaddata with UUIDs as natural foreign keys does not work anymore
-------------------------------------+-------------------------------------
Reporter: GunnarScherf | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Normal | Resolution:
Keywords: UUID loaddata | Triage Stage:
--natural-foreign | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GunnarScherf):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> When I run dumpdata with a model which has a UUIDField as a natural key,
> the dump can not be loaded anymore.
> {{{
> manage.py dumpdata --natural-foreign myapp
> manage.py loaddata myapp
> }}}
>
> The dump looks like this
> {{{
> [
> {
> "model": "accounts.applicationrole",
> "fields": {
> "application": [
> "ec1e39cb-e3e7-46c7-87b7-70ace4165d13"
> ],
> ...
> }}}
> The error message in loaddata is:
> {{{
> '(UUID('ec1e39cb-e3e7-46c7-87b7-70ace4165d13'),)' is not a valid UUID.
> }}}
New description:
When I run dumpdata with a model which has a UUIDField as a natural key,
the dump can not be loaded anymore.
{{{
manage.py dumpdata --natural-foreign myapp
manage.py loaddata myapp
}}}
The model :
{{{#!python
class ApplicationManager(models.Manager):
def get_by_natural_key(self, uuid):
return self.get(uuid=uuid)
class Application(models.Model):
uuid = models.UUIDField(unique=True, default=uuid.uuid4,
editable=True)
...
}}}
The dump looks like this
{{{
[
{
"model": "accounts.applicationrole",
"fields": {
"application": [
"ec1e39cb-e3e7-46c7-87b7-70ace4165d13"
],
...
}}}
The error message in loaddata is:
{{{
'(UUID('ec1e39cb-e3e7-46c7-87b7-70ace4165d13'),)' is not a valid UUID.
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25794#comment:1>
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/070.f82e0a68bc306f96e4533470fdd16d41%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.