#16476 closed Cleanup/optimization (duplicate)
inspectdb should rather render ForeignKeyField object name as string not object
| Reported by: | Matt Harasymczuk | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 1.3 |
| Severity: | Normal | Keywords: | |
| Cc: | djangoproject.com@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
IMHO inspectdb should rather render ForeignKeyField object name as string not object.
Models are dumped in alphabetical order and outputting ForeignKeyField argument as quoted string solves problem with reordering classes and import.
Note:
See TracTickets
for help on using tickets.
If I understand correctly, the idea is to make inspectdb produce this kind output:
class Car(models.Model): manufacturer = models.ForeignKey('production.Manufacturer')instead of this:
from production.models import Manufacturer class Car(models.Model): manufacturer = models.ForeignKey(Manufacturer)in order to avoid circular dependencies at import time.
Then it's a duplicate of #15076.