Opened 10 years ago

Closed 5 months ago

Last modified 5 months ago

#11929 closed Cleanup/optimization (fixed) dumpdata outputs YAML in unhelpful order

Reported by: sampablokuper Owned by: Tobias Kunze
Component: Core (Serialization) Version: master
Severity: Normal Keywords:
Cc: sam.kuper@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The docs suggest providing initial YAML data in the following format:

- model: myapp.person
  pk: 1
    first_name: John
    last_name: Lennon

but the dumpdata outputs YAML in the following form:

-   fields: {first_name: John, last_name: Lennon}
    model: myapp.person
    pk: 1

The fact that this is flow rather than block style YAML is the subject of #11927, but there's another problem, which is that rather than putting the model and PK first (which is most human-readable), dumpdata outputs the fields first.

Change History (12)

comment:1 Changed 10 years ago by sampablokuper

This might be helpful for generating a patch.

comment:2 Changed 10 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:4 Changed 8 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 Changed 8 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 Changed 7 years ago by ladyrassilon

Owner: changed from nobody to ladyrassilon

comment:7 Changed 6 years ago by AeroNotix

Owner: changed from ladyrassilon to AeroNotix
Status: newassigned

comment:8 Changed 6 years ago by Tim Graham

Has patch: set
Needs tests: set
Type: BugCleanup/optimization

The current PR needs a test.

comment:9 Changed 5 months ago by Tobias Kunze

Owner: changed from AeroNotix to Tobias Kunze

comment:10 Changed 5 months ago by Tobias Kunze

Needs tests: unset
Version: 1.1master

Since on our way to 3.0 we have dropped support for Python < 3.6, dictionaries can be assumed to be ordered, and YAML output was already in the order suggested in this ticket. I submitted a PR to guard against regressions, though.

comment:11 Changed 5 months ago by felixxm

Resolution: fixed
Status: assignedclosed

comment:12 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In a9b88982:

Refs #11929 -- Fixed ordering of test YAML dumps.

Thanks Nick Pope for the review.

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