Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#16476 closed Cleanup/optimization (duplicate)

inspectdb should rather render ForeignKeyField object name as string not object

Reported by: haras 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 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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 Changed 4 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

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