Code

Opened 4 years ago

Closed 4 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"

Attachments (0)

Change History (1)

comment:1 Changed 4 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.