Solution:
db.evento.giorno_inizio.represent = lambda giorno_inizio, row: 
T(giorno_inizio)

But I don't know whhy I have to specify "row" in tha lambda function...

Il giorno venerdì 5 maggio 2017 22:44:10 UTC+2, Dave S ha scritto:
>
>
>
> On Friday, May 5, 2017 at 12:09:38 PM UTC-7, Andrea Fae' wrote:
>>
>> I have this table
>>
>> db.define_table('evento',
>>                 Field('titolo', requires=[IS_NOT_EMPTY()]),
>>                 Field('inizio', type='datetime'),
>>                 Field('fine', type='datetime'),
>>                 Field.Virtual('giorno_inizio', lambda 
>> row:calendar.day_name[row.evento.inizio.weekday()]),
>>                 Field('risorsa', 'reference risorsa'),
>>                 Field('docente', 'reference auth_user'),
>>                 Field('materia', 'reference materia'),
>>                 Field('studenti', 'list:reference auth_user'),
>>                 Field('colore', default = '#8080ff'),
>>                 
>> auth.signature,singular="Evento",plural="Eventi",migrate='evento.table',
>>                 format='%(titolo)s')
>>
>> This is the grid
>>
>> form = SQLFORM.grid(query, args=[studente], fields=[db.evento.titolo, 
>> db.evento.giorno_inizio, db.evento.inizio, db.evento.fine, 
>> db.evento.risorsa, db.evento.materia, db.evento.docente],create=False, 
>> details=False, editable=False, deletable=False, searchable=False, 
>> maxtextlength=60, exportclasses = exportcls)
>>
>> ...but I see db.evento.giorno_inizio in english (like Monday, Tuesday, 
>> ecc.), but I want in italian? Hoe to do?
>> Thank you
>>
>
> I think the answer involves a represents clause and T(), but since I don't 
> yet have to support other-than-English, I am not able to go further.  But 
> look at the examples under
> <URL:
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor
> >
>
>  /dps
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to