﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18343	Refactor deferred model implementation	Anssi Kääriäinen	nobody	"There are a couple of places in the deferred model implementation which needed cleanup.
  - in models/query_utils.py:
    1. the attribute loaded is dead code.
    2. the weak_ref to model isn't needed.
    3. improve the handling of inheritance primary key cases (if parent_ptr_id is already fetched, then assessing pk should not generate any database queries, as parent_ptr_id already contains the value).
  - in models/base.py:
    1. `Model.__reduce__` contained a dead variable, and stupid logic using that dead variable.
  - a minor cleanup to tests/modeltests/field_subclassing/tests.py to spot errors earlier if they happen

The work is tracked in branch [https://github.com/akaariai/django/tree/defer_inheritance_pk defer_inheritance_pk], I will create a pull request soon."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Unreviewed	0	0	0	0	0	0
