Opened 12 years ago
Closed 12 years ago
#18343 closed Cleanup/optimization (fixed)
Refactor deferred model implementation
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There are a couple of places in the deferred model implementation which needed cleanup.
- in models/query_utils.py:
- the attribute loaded is dead code.
- the weak_ref to model isn't needed.
- 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:
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 defer_inheritance_pk, I will create a pull request soon.
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Pull request: https://github.com/django/django/pull/80