From: Andreas J. <li...@zo...> - 2008-08-12 04:14:50
|
--On 11. August 2008 18:40:05 -0400 Sean K <se...@ho...> wrote: > I have a content type with a field that displays a nice list when adding > or editing my content type. I want to display the value in my view > template but I am not sure what the best way to do this is. Below is > the python used to create the field. Is this best done in the template > with some sort of conditonal statement or best done at the catalog > level? Is there a kind of index I can use to display this such that > 'Not Trained' is displayed instead of '0' when one asks for the value of > TrainLevel? First, you hopefully don't access the 'TrainLevel' attribute directly? (We have accessor methods for accessing field values - you have to use them) Second, if you don't want values 0...N then don't use the in the vocabulary. Using the same key and value is totally legitimate. If you need something else: look at the DisplayList API or write a small method returning whatever you need from a DisplayList either based on a key or a value. That's just a two-line iteration in Python (and a pretty simple Python exercise). -aj |