#6773: Confusing error when ForeignKey lookup fails while serializing -------------------------------------+------------------------------------- Reporter: kcarnold | Owner: Type: | Status: closed Cleanup/optimization | Component: Core Milestone: | (Serialization) Version: 1.2-alpha | Severity: Normal Resolution: needsinfo | Keywords: dumpdata exception Triage Stage: Design | Has patch: 0 decision needed | Needs tests: 1 Needs documentation: 1 | Easy pickings: 0 Patch needs improvement: 0 | UI/UX: 0 | -------------------------------------+------------------------------------- Changes (by ethanp):
* cc: ethanp (added) Comment: I encountered this exact same problem with Django 1.3 when working with some legacy data. Whilst `validate` returned no errors, `dumpdata` reported the error "Space matching query does not exist." The problem was that the legacy data allowed a value of `0` for a blank foreign key, instead of `NULL`. Django was (logically) unable to match the ID `0` to an existing foreign row. To fix the issue, I updated the legacy data to use `NULL` instead of `0` for blank foreign keys. I agree that the error message could be more explicit or maybe `validate` could catch these types of problems? -- Ticket URL: <https://code.djangoproject.com/ticket/6773#comment:18> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.