1) please use Field and not SQLFIeld (deprecated)

2) represent is called automatically only by SQLTABLE and crud.read
and crud.update. You have to call it explicitly in every other
circumstance.

Massimo

On Aug 14, 9:02 am, tiffany <vaidehi.3...@gmail.com> wrote:
> i have declared my database as,
>
> db.define_table('song',
>
> SQLField('name','string',requires=IS_NOT_EMPTY(),label='Name of the
> Song'),
>
> SQLField('album_id',db.album,label='Album',requires=IS_IN_DB(db,'album.id','%
> (name)s')),
>
> SQLField('genre',db.Genre,label='Genre',requires=IS_IN_DB(db,'Genre.id','%
> (name)s')),
>             SQLField('rating','double',default=0,label='Rating'),
>             SQLField('lyrics','upload',label='Lyrics',comment='upload
> song\'s lyrics file'),
>
> SQLField('language','string',requires=IS_IN_SET(['Hindi','English']),default='Hindi',widget=SQLFORM.widgets.radio.widget),
>
> SQLField('file','upload',requires=IS_NOT_EMPTY(),comment='upload song
> file'),
>             SQLField('no_artist','integer',label='No. of Artists'),
>             SQLField('user_id',db.auth_user,label='Posted by'))
>
> db.song.user_id.default= auth.user.id if auth.user else 0
> db.song.user_id.represent=db.auth_user.first_name + ' ' +
> db.auth_user.last_name
>
> db.define_table('song_artist',
>
> SQLField('song_id',db.song,requires=IS_IN_DB(db,'song.id','%
> (name)s')),
>             SQLField('artist_name','string'))
>
> obj="""
> <object type="application/x-shockwave-flash" data="%(player)s?
> &song_url=%(url)s&" id="audioplayer1" height="24" width="290">
> <param name="movie" value="%(player)s?&song_url=%(url)s&">
> <param name="FlashVars" value="playerID=audioplayer1&soundFile=%
> (url)s&">
> <param name="quality" value="high">
> <param name="menu" value="false">
> <param name="wmode" value="transparent">
> </object> """
>
> db.song.file.represent=lambda file:
> SPAN(A('download',_href=URL(r=request,c='default',f='download',args=file)),BR(),XML(obj
> %
> dict(player=URL(r=request,c='static',f='player.swf'),url=URL(r=request,c='default',f='download',args=file))))
>
> however it does not seem to be working.. maybe there is some problem
> with represent... can u plz tell me what is wrong... and why isn't the
> music playing(even the player is not seen) in the application... while
> the same thing is working for another application

Reply via email to