Opened 15 years ago

Closed 6 years ago

Last modified 6 years ago

#11929 closed Cleanup/optimization (fixed)

manage.py dumpdata outputs YAML in unhelpful order

Reported by: sampablokuper Owned by: Tobias Kunze
Component: Core (Serialization) Version: dev
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

Description

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

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

but the manage.py 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 by sampablokuper, 15 years ago

This might be helpful for generating a patch.

comment:2 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Julien Phalip, 14 years ago

Severity: Normal
Type: Bug

comment:4 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by ladyrassilon, 12 years ago

Owner: changed from nobody to ladyrassilon

comment:7 by AeroNotix, 11 years ago

Owner: changed from ladyrassilon to AeroNotix
Status: newassigned

comment:8 by Tim Graham, 11 years ago

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

The current PR needs a test.

comment:9 by Tobias Kunze, 6 years ago

Owner: changed from AeroNotix to Tobias Kunze

comment:10 by Tobias Kunze, 6 years ago

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 by Mariusz Felisiak, 6 years ago

Resolution: fixed
Status: assignedclosed

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

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