Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25050 closed Bug (fixed)

When the default manager returns a queryset with a deferred field, the dumpdata command fails to produce importable data.

Reported by: cecedille1 Owned by: nobody
Component: Core (Serialization) Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When the default manager returns a queryset that has deferred fields, with Queryset.only or Queryset.deferred, the dumpdata command will print the model name as *the model*_derred_*thefields*. This model name make the import fail.

I made a github project to expose the bug: https://github.com/cecedille1/DjangoBug

I've a project with a table containing images as blobs. I deferred the image to avoid retrieving too many datas from the database.

Attachments (1)

deferred-field.patch (2.4 KB ) - added by cecedille1 9 years ago.
Patch

Download all attachments as: .zip

Change History (7)

comment:1 by Tim Graham, 9 years ago

Component: UncategorizedCore (Serialization)
Triage Stage: UnreviewedAccepted

comment:2 by Simon Charette, 9 years ago

Easy pickings: set

This should be only a matter of making the python serializer `get_dump_object` method deal with deferred models.

by cecedille1, 9 years ago

Attachment: deferred-field.patch added

Patch

comment:3 by cecedille1, 9 years ago

When running the serialization I resolve the original model from the meta.

comment:4 by Tim Graham, 9 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In c6cce4de:

Fixed #25050 -- Allowed serialization of models with deferred fields.

comment:6 by Tim Graham <timograham@…>, 9 years ago

In c0c7fa48:

Refs #25050 -- Corrected test assertion in serializers test.

Note: See TracTickets for help on using tickets.
Back to Top