[Django] #20946: Clean up related field foreign value fetching implementation

29 views
Skip to first unread message

Django

unread,
Aug 21, 2013, 12:59:50 AM8/21/13
to django-...@googlegroups.com
#20946: Clean up related field foreign value fetching implementation
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.5
Component: Database | Keywords:
layer (models, ORM) | Has patch: 0
Severity: Normal | Needs tests: 0
Triage Stage: Accepted | Easy pickings: 0
Needs documentation: 0 |
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
There are currently two ways to fetch the foreign key value from the
instance in fields/related.py. The other is get_foreign_related_value()
and the other is ._get_fk_val(). The latter only works for single column
foreign values. Also, these methods do slightly different things. So,
getting rid of ._get_fk_val() seems like a good idea to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/20946>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 21, 2013, 1:21:35 AM8/21/13
to django-...@googlegroups.com
#20946: Clean up related field foreign value fetching implementation
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.5
Component: Database layer | Resolution: fixed
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Anssi Kääriäinen <akaariai@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"b065aeb17f9daf395e22d4d5f9f49c0e2c7f4522"]:
{{{
#!CommitTicketReference repository=""
revision="b065aeb17f9daf395e22d4d5f9f49c0e2c7f4522"
Fixed #20946 -- model inheritance + m2m failure

Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20946#comment:1>

Django

unread,
Aug 23, 2013, 7:41:44 AM8/23/13
to django-...@googlegroups.com
#20946: Clean up related field foreign value fetching implementation
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.5

Component: Database layer | Resolution: fixed
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"244e2b71f512605f3d0a8e1ba4c9d6b538acf69d"]:
{{{
#!CommitTicketReference repository=""
revision="244e2b71f512605f3d0a8e1ba4c9d6b538acf69d"


Fixed #20946 -- model inheritance + m2m failure

Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20946#comment:2>

Django

unread,
May 21, 2014, 5:58:06 PM5/21/14
to django-...@googlegroups.com
#20946: Clean up related field foreign value fetching implementation
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.5

Component: Database layer | Resolution: fixed
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Ramiro Morales <cramm0@…>):

In [changeset:"862e1ff2340a1e28a3e7c6904d2b0283085f34c8"]:
{{{
#!CommitTicketReference repository=""
revision="862e1ff2340a1e28a3e7c6904d2b0283085f34c8"
Fixed #22421 -- Regression in fixtures loading.

Loading fixtures were failing since the refactoring in 244e2b71f5 for
inheritance setups where the chain contains abstract models and the
root ancestor contains a M2M relation.

Thanks Stanislas Guerra for the report.

Refs #20946.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20946#comment:3>

Django

unread,
May 22, 2014, 7:40:32 AM5/22/14
to django-...@googlegroups.com
#20946: Clean up related field foreign value fetching implementation
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.5

Component: Database layer | Resolution: fixed
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"fb45e666c204d7188c38469ca1f661a9b113b85b"]:
{{{
#!CommitTicketReference repository=""
revision="fb45e666c204d7188c38469ca1f661a9b113b85b"
[1.7.x] Fixed #22421 -- Regression in fixtures loading.

Loading fixtures were failing since the refactoring in 244e2b71f5 for
inheritance setups where the chain contains abstract models and the
root ancestor contains a M2M relation.

Thanks Stanislas Guerra for the report.

Refs #20946.

Backport of 862e1ff234 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20946#comment:4>

Reply all
Reply to author
Forward
0 new messages