KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have two classes that refer to each other, but obviously the compiler complains. Is there any way around this? EDIT Actually my code is slightly different than what Hank Gay uses. So python can definitely deal with some kinds of circular references, but it tosses an error in the following situation. Below is what I've got and I get an 'name Y not defined error' class X(models.Model): creator = Registry() creator.register(Y) class Y(models.Model): a = models.ForeignKey(X) b = models.CharField(max_length=200) Hope this helps clarify. Any suggestions.
Tags (comma-separated)
Save Edits
Cancel