|
From: Michel T. <mic...@ya...> - 2004-11-10 04:17:54
|
Hi!
I faced the same problem, a parent has many children, I don't know well
you case, my case isn't many-to-many, it is one to many, one parent to
many children, each child can be a parent but cannot have more then one
parent.
My application is a forum, I ned a MultipleJoin and a ForeignKey o the
same table but that time I couldn't have. I was creating the table
throught SQLObject and I can't create a foreign key to a not existent
table (the same table that doesn't exists yet).
Maybe you can create the table manually, I don't try this way, I think
this possibility just now :), you can create a ForeignKey yourself, I
done this way:
class Forum:
parentID=IntCol(default=None)
def _get_parent(self):
return self.parentID and Forum.get(self.parentID) or None
def _get_childs(self):
return list(Forum.select(Forum.q.parentID==self.id))
def _create(self, id, **kw):
kw['parentID']=kw.pop('parent').id
This way you can work like that: Forum(parent=x)...
Sorry my poor english, I hope I could help you...
--- Ksenia Marasanova <kse...@gm...> escreveu:
> Hi,
>
> I solved this:
> http://sourceforge.net/mailarchive/message.php?msg_id=9996700
> (don't have it in mijn mailbox for some reason) by explicitly
> declaring a class for the third (many-to-many) table and adding
> "cascade" attribute to the columns of this table.
>
> Now another question: how to search RelatedJoin? I have a table
> Address with many-to-many relation to it self. Address kan have
> multiple addresses as parents, and can be a parent on it's own. I'd
> like to find all children of given parent. How should I build this
> query with SQLObject?
>
>
> Thanks!
>
> --
> Ksenia
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
=====
--
Michel Thadeu Sabchuk
Curitiba/PR
_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/
|