Opened 5 years ago

Closed 5 years ago

#13422 closed (invalid)

NameError with Recursive Model

Reported by: jprafael@… Owned by: nobody
Component: Core (Other) Version: 1.1
Severity: Keywords: recursive model namerrror
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When i try to create a double recursive model like:

class Cell(models.Model):
    pos = models.ForeignKey(Pos)

class Pos(models.Model):
    ...
    current_cell = models.ForeignKey(Cell)

i get "NameError: name 'Pos' is not defined"

Change History (1)

comment:1 Changed 5 years ago by anonymous

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

This is expected behavior, not a bug. See the relevant documentation: http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey

Please post further questions to the django-users mailing list or the Freenode #django IRC channel.

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