just use

auth.user_id

is the same

created_by should be type=db.auth_user

On Sep 28, 10:31 pm, johntynan <[email protected]> wrote:
> if auth.is_logged_in():
>     me=auth.user.id
> else:
>     me=None
>
> On Sep 29, 5:19 am, mdipierro <[email protected]> wrote:
>
> > what is me? Do you use auth? why the type of created_by is a string?
>
> > On Sep 28, 10:01 pm, johntynan <[email protected]> wrote:
>
> > > I would like to create a many-to-many relationship in the following
> > > model, where many "stories" can appear in many different
> > > "roadtrips" (think songs to mixtapes).
>
> > > db.define_table(
> > >     'roadtrip',
> > >     Field('name'),
> > >     Field('description', 'text'),
> > >     Field('created_by',default=me,writable=False,readable=False),
>
> > > Field('created_on','datetime',default=request.now,writable=False,readable=F
> > >  alse)
> > >     )
>
> > > db.define_table(
> > >     'story',
> > >     Field('user_id', db.users,readable=False,writable=False),
> > >     Field('roadtrip_id', db.roadtrip),
> > >     Field('story_id', 'integer'),
> > >     Field('title'),
> > >     Field('latitude'),
> > >     Field('longitude'),
> > >     Field('comment', 'text'),
> > >     Field('created_by',default=me,writable=False,readable=False),
>
> > > Field('created_on','datetime',default=request.now,writable=False,readable=F
> > >  alse)
> > >     )
>
> > > db.story.roadtrip_id.requires=IS_IN_DB(db(db.roadtrip.created_by==me),'road
> > >  trip.id','%
> > > (name)s')
>
> > > I am able to create a multiple-select element on the CRUD form by
> > > simply adding "multiple=True" to this
>
> > > db.story.roadtrip_id.requires=IS_IN_DB(db(db.roadtrip.created_by==me),'road
> > >  trip.id','%
> > > (name)s', multiple=True)
>
> > > However, I am receiving the error:
>
> > > TypeError: int() argument must be a string or a number, not 'list'
>
> > > I posted the traceback here:http://pastie.textmate.org/1187996
>
> > > (as an aside, is there a better way to post a traceback that is more
> > > readable, should I just copy/paste from the html error page, as
> > > opposed to the logged file under errors?)
>
>

Reply via email to