Code

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#20946 closed Cleanup/optimization (fixed)

Clean up related field foreign value fetching implementation

Reported by: akaariai Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Attachments (0)

Change History (2)

comment:1 Changed 8 months ago by Anssi Kääriäinen <akaariai@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 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.

comment:2 Changed 8 months ago by Andrew Godwin <andrew@…>

In 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.