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 Mariusz Felisiak, 3 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

comment:2 by Manaia Junior, 3 years ago

Owner: changed from nobody to Manaia Junior
Status: newassigned

comment:3 by AllenJonathan, 3 years ago

I would like to give this a try if someone can guide me on how to proceed with this problem.

comment:4 by Adam Johnson, 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 AllenJonathan, 3 years ago

Owner: changed from Manaia Junior to AllenJonathan

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 AllenJonathan, 3 years ago

Has patch: set

comment:7 by Mariusz Felisiak, 3 years ago

Needs tests: set
Patch needs improvement: set

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 205f67c:

Refs #33216 -- Made @deconstructible do not change path for subclasses.

comment:9 by Mariusz Felisiak, 3 years ago

Needs tests: unset
Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 28c98d41:

Fixed #33216 -- Simpilified deconstructed paths for some expressions.

Note: See TracTickets for help on using tickets.
Back to Top