Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26999 closed Cleanup/optimization (fixed)

Request to add changes to ``model_to_dict`` in Django 1.10 to the release notes

Reported by: Aaron Lelevier Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

It seems that the django.forms.models.model_to_dict function changed with the way that it treats many-to-many related objects. Before, it was returning them in a list if ID's. Not it's returning them as a queryset.

Commit that caused the change:

https://github.com/django/django/commit/ded502024191053475bac811d365ac29dca1db61

The logic is here in the model_to_dict method:

https://github.com/django/django/blob/1.10/django/forms/models.py#L91

And here in the field method:

https://github.com/django/django/blob/1.10/django/db/models/fields/related.py#L1564-L1570

I'd like to request to add this to the release notes for Django 1.10. I couldn't find any note of it in there. I didn't know about the change, and it caused some code to break. No big deal, was able to locate the issue. Just want to point it out in case others may experience it.

Thank you

Change History (3)

comment:1 by Tim Graham, 8 years ago

Has patch: set
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

We don't normally document private API changes, however, my sense is that model_to_dict() is widely used even though it's not documented. How about:

* Private API ``django.forms.models.model_to_dict()`` returns a queryset for
  ``ManyToManyField``\s rather than a list of IDs.

comment:2 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In f4b1f972:

Fixed #26999 -- Documented model_to_dict() ManyToManyField change in 1.10.

comment:3 by Tim Graham <timograham@…>, 8 years ago

In b00a3f17:

[1.10.x] Fixed #26999 -- Documented model_to_dict() ManyToManyField change in 1.10.

Backport of f4b1f972dc69e519a78182353e43701a17bb43aa from master

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