On 12/15/06, leanmeandonothingmachine
<[EMAIL PROTECTED]> wrote:
>
> I have a model where the foreign key refers to it self.
> parent = models.ForeignKey('self', core=True, null=True, blank=True)
>
> What i want to do is to be able to run a query with select_related and
> get all the parents of th
You can still get all the parents using a cycle:
current = Content.objects.select_related().get(pk=3)
while current:
# do something with the current object, i.e. write to a list
# ...
current = current.parent # get the parent of the current
Good luck!
Aidas Bendoraitis aka Archatas
2 matches
Mail list logo