[SQLObject] Problem with RelatedJoin

2007-05-12 Thread TiNo
- def add(self, inst, other): inst._connection._SO_intermediateInsert( self.intermediateTable, self.joinColumn, getID(inst), self.otherColumn, getID(other)) --

Re: [SQLObject] Problem with RelatedJoin

2007-05-13 Thread TiNo
AIL PROTECTED]>: On Sat, May 12, 2007 at 07:40:04PM +0200, TiNo wrote: > File "F:\Dev\Python\Photon\photon\model.py", line 52, in > _set_keywords >self.addKeyword(1) What is it? Oleg. - This SF.ne

Re: [SQLObject] Problem with RelatedJoin

2007-05-13 Thread TiNo
Yes, it works. instead of: Photo(filename="bla.jpg",keywords="k1,k2") I now do: p = Photo(filename="bla.jpg") p.keywords = "k1,k2" and that works. 2007/5/13, Oleg Broytmann <[EMAIL PROTECTED]>: On Sun, May 13, 2007 at 02:53:11PM +0200, T

[SQLObject] Creating a complicated query (with MTM relations)

2007-05-14 Thread TiNo
Hi, I have a db model that looks like this: class Photo(SQLObject): filename = StringCol(length=30,alternateID=True) keywords = RelatedJoin("Keyword") shot_date = DateTimeCol(default=None) place = StringCol(default=None) class Keyword(SQLObject): keyword = StringCol(alternateID=Tr

Re: [SQLObject] Creating a complicated query (with MTM relations)

2007-05-15 Thread TiNo
2007/5/15, Oleg Broytmann <[EMAIL PROTECTED]>: > 1) How do I select all photos that have keyword1 AND keyword2? photos = [] for photo on Photo.select(): found = 0 for keyword in photo.keywords: if keyword.keyword in ("test1", "TeSt2"): found += 1 if found == 2: ph

Re: [SQLObject] Creating a complicated query (with MTM relations)

2007-05-15 Thread TiNo
2007/5/15, Oleg Broytmann <[EMAIL PROTECTED]>: > And if so, is there another way to do this? Do it SQL-wise. Recreate and declare the intermediate table, and do a join. Ok, I figured out the join I need to do, and I declared the intermediate table like this: class Photo(SQLObject): [...

Re: [SQLObject] Selecting from multiple tables/classes.

2007-06-08 Thread TiNo
Do a (left) join. (About joins: http://www.w3schools.com/sql/sql_join.asp) And on how to do it with SQLObject: http://www.sqlobject.org/FAQ.html#how-can-i-do-a-left-join and http://www.sqlobject.org/SQLObject.html#left-join-and-other-joins TiNo 2007/6/8, Nick Murdoch <[EMAIL PROTECTED]>

Re: [SQLObject] Distinct value lookup on DateTimeCol()

2007-06-21 Thread TiNo
have to find the dates for what you call 'next week'... TiNo 2007/6/18, F.A. Pinkse <[EMAIL PROTECTED]>: Hi, Oeps, I did hit the send button to soon and forgot to add this. So the year part is solved but now what can I do when I want to construct a monthly birthday cal

Re: [SQLObject] Problem with re-ordering rows.

2007-07-12 Thread TiNo
iving an order number. Seems easier to me than the prevs and nexts. just my 2 pence, TiNo 2007/7/12, Nick Murdoch <[EMAIL PROTECTED]>: Hi all, I'm attempting to write an app that will let me create a set of Acts, where each Act can contain some Scenes, and each Scene can contain some

Re: [SQLObject] Object ID and String

2007-07-30 Thread TiNo
How about creating a _get method in your class like: def _get_ident(self): return self.namespace + ':' + str(self.id) You have to give the identifier a different name, but it does what you want in a simple way. You now get your identifier by 'object.ident' TiNo 2007/