my first attemp in lektor: I want to create my own Data Model for architectural works record.
I have a wierd ouput for checkboxes
and lists
like:
[u'corporate & commercial', u'interiors']
Where the poject.ini
is
[fields.type]
label = Project type
type = checkboxes
choices = corporate & commercial, residential, interiors, public,hotel/tourism, university, art gallery, restoration, spa, auditorium, installations, landscape
choice_labels = corporate & commercial, residential, interiors, public, hotel/tourism, university, art gallery, restoration, spa, auditorium, installations, landscape
and the project.html
has:
{% if this.type %}
<tr>
<th scope="row">Type</th>
<td>{{ this.type}}</td>
</tr>
{% endif %}
Where are those [u'
in the ouput coming from? What am I missing?
Thank you
AR (running lektor 3.0.1 on win 7/64)
When you call
{{ this.type }}
, you’re getting the full, raw results of your entire array.Having looked at your example page, it looks like what you’re aiming to do is to call each item separately as a list. To do this, you need to loop through the array:
This should output as ‘Item 1, Item 2, Item 3’. If you want to change the separator, edit the bit between
{% if not loop.last %}
and{% endif %}
.