Opened 15 years ago
Closed 15 years ago
#13422 closed (invalid)
NameError with Recursive Model
Reported by: | 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: | no | UI/UX: | no |
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"
Note:
See TracTickets
for help on using tickets.
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.