Hi Massimo,

Sorry for my poor explanation.

What I don't get is in the view when i call the field value 
{{=tipo_3.descripcion}}  I get the whole text and not the truncated one 
like in the SQLFORM.grid case.




On Tuesday, September 11, 2012 9:32:18 AM UTC-3, Massimo Di Pierro wrote:
>
> What does it mean it does not work? Can you import it? Can you import it 
> from python?
>
> On Tuesday, 11 September 2012 00:55:03 UTC-5, Pepe Araya wrote:
>>
>> Hello,
>>
>> I need to truncate a field that contains HTML content. 
>>
>> Now i'm using htmltruncate <https://github.com/eentzel/htmltruncate.py> in 
>> a controller that return a SQLFORM.smartgrid and it works perfect:
>>  
>> def noticias():
>>     
>>     db.noticias.cuerpo.represent = lambda field,row: 
>> XML(htmltruncate.truncate(field, 100))
>>     grid = SQLFORM.smartgrid(db.noticias, 
>> linked_tables=['adjuntos_noticia'])
>>
>>     return dict(grid =grid)
>>
>>
>> But when I try to implement a in a controller in this way:
>>
>> def index():
>>     db.publicaciones.descripcion.represent = lambda field, row: 
>> XML(htmltruncate.truncate(field, 10))
>>     tipo_3 = db(db.publicaciones.tipo == 3).select().last()
>>
>>     return dict(tipo_3 = tipo_3)
>>
>>
>> It doesn't work
>>
>>
>> The module is inside the "modules" folder of the app and it's imported 
>> via:
>> import htmltruncate
>>
>>
>> any help is welcome!
>>
>> Best!
>>
>

-- 



Reply via email to