Opened 17 years ago

Closed 17 years ago

#5642 closed (duplicate)

[patch] models.ForeignKey('unloaded class') raises AttributeError

Reported by: Gregor_Kopka Owned by: nobody
Component: Core (Other) Version: dev
Severity: Keywords: ForeignKey AttributeError db/models/options.py
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

using

models.ForeignKey('undefined class')

in model definition raises an Attribute error:

File "/usr/lib/python2.4/site-packages/django/db/models/options.py", line 156, in get_all_related_objects

if f.rel and self == f.rel.to._meta:

Using the attached patch the output will be:

Error: One or more models did not validate:
<reasonable error message>

Attachments (1)

patch-foreignkey-attributeerror.diff (6.9 KB ) - added by Gregor_Kopka 17 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Gregor_Kopka, 17 years ago

Summary: models.ForeignKey('unloaded class') raises AttributeError[patch] models.ForeignKey('unloaded class') raises AttributeError

comment:2 by Gregor_Kopka, 17 years ago

Seems like i missed #3323 when searching for existance of the bug.
Updated the patch to get the many-to-many relation error described there too.

comment:3 by Gregor_Kopka, 17 years ago

Resolution: duplicate
Status: newclosed

Added the patch to #3323.
Closing this one.

by Gregor_Kopka, 17 years ago

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