Hi
With the code that I send in the previous mail, the crud.select() list
should appear as:
Actions | Name | Title | Type | State
Work, Card | project_name | Project Title | devel | In process
Where "Actions" field is the "id.represent", and Type and State are
fields with the "reference" type.
But now it appears like this:
Actions | Name | Title | Type | State
9 | project_name | Project Title | 1 | 1
In the view html i have only this:
{{extend 'layout.html'}}
{{=form}}
I don't have any "linkto" parameter.
Thanks in advance.
El lun, 22-11-2010 a las 05:35 -0800, mdipierro escribió:
> What do you mean: it does not work?
>
> The only change in this respect is that represent for id fields and
> reference fields in now ignored by SQLTABLE if linkto is passed. This
> is because linkto is used by appadmin and appadmin breaks when those
> fields have a represent.
>
> Massimo
>
> On Nov 22, 4:10 am, demetrio <[email protected]> wrote:
> > Hi,
> >
> > I have a problem with the represent functionality. In version 1.89.1
> > it was working fine, but then i updated to 1.89.4 and now to 1.89.5 (I
> > don't know if it happens on .2 and .3), and it doesn't works.
> > Moreover, the fields with the "reference", now show the id of the
> > table instead the format that i have specified.
> >
> > I don't know if the represent functionality has changed since 1.89.1
> > or i'm doing something wrong.
> >
> > One example is this:
> >
> > ############### begins code ####################
> > @auth.requires_login()
> > def index():
> > # Clean user acl
> > vip_user.clean_project()
> >
> > # Prepare user's desktop by profile in application
> > if vip_user.is_admin:
> > response.menu += admin_menu
> > db.project_card.id.represent = lambda id: DIV(A(T("Team"),
> > _href=URL(r=request, c='project_team', f='index', args=(id))),"
> > ",A(T("Services"), _href=URL(r=request, c='project_service',
> > f='index', args=(id))))
> > query = None
> > else:
> >
> > db.project_card.id.represent = lambda id: DIV(A(T("Work"),
> > _href=URL(r=request, c='project', f='index', args=(id)))," ",
> > A(T("Card"), _href=URL(r=request, c='project_card', f='read',
> > args=(id))))
> > query=((db.project_card.id==db.project_team.project) &
> > (db.project_team.user==vip_user.id))
> >
> > form = crud.select(db.project_card,
> > query = query,
> > fields = ['project_card.id',
> > 'project_card.name', 'project_card.title', 'project_card.type',
> > 'project_card.status', 'project_card.start_date',
> > 'project_card.end_date' ],
> > headers = {'project_card.id': T("Actions"),
> > 'project_card.name': 'Nombre', 'project_card.title': 'Título',
> > 'project_card.type': 'Tipo', 'project_card.status': 'Estado',
> > 'project_card.start_date': 'Inicio', 'project_card.end_date':
> > 'Finalización' })
> >
> > return dict(form=form, user=vip_user)
> >
> > ############### ends code ####################
> >
> > And the table is defined like this:
> >
> > ############### begins code ##################
> >
> > db.define_table('project_card',
> > Field('name', 'string', length=50, required=True, notnull=True,
> > label=T('Nombre')),
> > Field('title', 'string', length=200, required=True,
> > label=T('Título')),
> > Field('type', 'reference project_type', required=True,
> > label=T('Tipo')),
> > Field('private', 'reference privacity', required=True,
> > label=T('Privacidad')),
> > Field('status', 'reference project_status', required=True,
> > label=T('Estado')),
> > Field('description', 'text', required=True,
> > label=T('Descripción')),
> > Field('start_date', 'datetime', required=True, label=T('Inicio')),
> > Field('end_date', 'datetime', required=True,
> > label=T('Finalización')),
> > Field('objetive', 'text', label=T('Alcance')),
> > Field('resume', 'text', label=T('Resumen')),
> > Field('url', 'string', length=400, label=T('Url')),
> > format='%(name)s')
> >
> > ############### ends code ####################
> >
> > Regards