Opened 9 years ago
Closed 9 years ago
#26710 closed Cleanup/optimization (fixed)
CreateModel.references_model should take app_label into account
| Reported by: | Sergey Fedoseev | Owned by: | Sergey Fedoseev |
|---|---|---|---|
| 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: | no | UI/UX: | no |
Description
CreateModel.references_model doesn't take app_label into account, this blocks some optimizations. For example:
MigrationOptimizer().optimize(
[
migrations.CreateModel("Foo", [("name", models.CharField(max_length=255))]),
migrations.CreateModel("Bar", [("other", models.ForeignKey("testapp.Foo", models.CASCADE))]),
migrations.DeleteModel("Foo"),
],
app_label="otherapp"
)
returns same operations, though creation and deletion of Foo could be collapsed, because this model is not referenced by Bar.
Change History (5)
comment:1 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 9 years ago
| Has patch: | set |
|---|
comment:3 by , 9 years ago
| Patch needs improvement: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 9 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
PR