Tuesday, September 21, 2010

Problem with ForeignKey()

I have a model with:

parent = ForeignKey('self', blank=True, null=True)

In that model I've overridden clean() to contain:

if self.parent:
# Do some stuff

It raises an attribute error saying that parent.pk doesn't exist. How
can I get around this. Note that my foreign key is recursive.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate