Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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.

Change History (2)

comment:1 by Aymeric Augustin, 13 years ago

Resolution: duplicate
Status: newclosed

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.

comment:2 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

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