[Cubicweb] customize rendering of a specific attribute in cw

aurélien campéas aurelien.campeas at gmail.com
Fri May 25 09:29:43 CEST 2012


On entity classes, there is a printable_value method that can also be
customized (on Airport in your case) .
This should be invoked (automatically) by the 'attribute' view (in
views/primary.py).


2012/5/25 Stéphane Bugat <stephane.bugat at free.fr>

> Hi all,
>
> I was wondering if there was a way to customize the rendering of a
> specific attribute of an entity.
> For instance, I have an Airport entity with 2 Float(), latitude and
> longitude. These floats are usually displayed using the form xx°yy'zz''
> (for instance 45.658333 ==> 45° 39' 30.00" N).
> At present I have modified the Airport PrimaryView function
> render_attributes(), but this means I have to set up how all other
> attributes are rendered. Moreover I have to do this for all specific
> context views of the Airport object.
> Another option would be to define a full Entity "Coordinate" and to put an
> inlined relation between Airport and Coordinate, but that would be a hammer
> to crush a fly.
>
> Thanks for any help!
>
> Stéphane
>
>
>
> _______________________________________________
> Cubicweb mailing list
> Cubicweb at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/cubicweb
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20120525/9e2645e2/attachment.htm>


More information about the Cubicweb mailing list