Well, you don't want to select images then, you want to select articles -
then get a single image attached to the article.
On Thursday, January 24, 2013 8:51:42 AM UTC-7, BlueShadow wrote:
>
> Hi I got two tables in my application one for images and one for articles.
> an artical can have multiple images attached to it.
> What I want to do is displaying a list of the newest images but there
> should only be one per article
> db.define_table('Images',
> Field('Headline',length=1024),
> Field('Image','upload'),
> Field('Submitted','datetime',default=datetime.datetime.now(),writable=
> False,readable=False),
> format = '%(Headline)s'
> )
>
> db.define_table('Article',
> Field('Title',length=512),
> Field('Content','text'),
> Field('Submitted','datetime',default=datetime.datetime.now()),
> Field('TopImage','reference Images', requires=IS_EMPTY_OR(IS_IN_DB(db,db
> .Images.id), null=None)),
> Field('BottomlImage','reference Images', requires=IS_EMPTY_OR(IS_IN_DB
> (db, db.Images.id), null=None)),
> Field('BottomrImage','reference Images', requires=IS_EMPTY_OR(IS_IN_DB
> (db, db.Images.id), null=None)),
> Field('InTextImage','list:reference Images')
> )
>
> Right now I got no clue how I should start to solve the problem.
> I want to do this because one article could have like 10 pictures and
> would completly fill the list of new images.
>
--