Opened 9 years ago
Last modified 9 years ago
#25794 closed Bug
loaddata with UUIDs as natural foreign keys does not work anymore — at Version 1
Reported by: | Gunnar Scherf | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.9rc1 |
Severity: | Normal | Keywords: | UUID loaddata --natural-foreign |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
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 :
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.
Note:
See TracTickets
for help on using tickets.