Opened 3 years ago
Closed 3 years ago
#33216 closed Cleanup/optimization (fixed)
Use simplified paths for deconstruct of expressions
Reported by: | Adam Johnson | Owned by: | AllenJonathan |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Previously F()
deconstructed to: django.db.models.expressions.F()
. But since it can also be imported from django.db.models
, PR #14047 changed it to deconstruct to django.db.models.F()
. This simplifies generated migration code where it will be referenced only as from django.db import models / models.F()
.
As Mariusz pointed out on the PR, the same technique can be applied to other expressions, further simplifying generated migrations.
Change History (10)
comment:1 by , 3 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 3 years ago
comment:4 by , 3 years ago
I don't think much more guidance can be given particular to this ticket. Did you see the example PR? Have you read the contributing guidelines and the first patch tutorial?
comment:5 by , 3 years ago
Owner: | changed from | to
---|
I have deconstructed Value() and submitted a pull request https://github.com/django/django/pull/15161. I'm not sure if I did the right thing because other expressions' path could be simplified as well but I haven't figured those out.
comment:6 by , 3 years ago
Has patch: | set |
---|
comment:7 by , 3 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
comment:9 by , 3 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
I would like to give this a try if someone can guide me on how to proceed with this problem.