Thanks Alan I try that tomorrow but it looks really great.

On Sunday, March 3, 2013 8:48:46 PM UTC+1, Alan Etkin wrote:
>
> >I need to show a selection(not all but specific ones) of the Pictures on 
> the Book/Movie page. So a refrence back to the Image table 
> > would be awesome.
>
> I'd use an intermediate table for that. Something like
>
> defnine_table("image_references", Field("image_id", "reference image"), 
> Field("referenced_table"), Field("referenced_id", "integer"))
>
> #Then you can link an image to another object with:
> db.image_references.insert(image_id=<id>, referenced_table="book", 
> referenced_id=<id>)
>
> # Now retrieve all images from The Count of Monte Cristo
> montecristo = db(db.book.name=="The Count of Monte 
> Cristo").select().first().id
> images = 
> db((db.image_references.referenced_table=="book")&(db.referenced_id==montecristo)).select()
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to