Personal tools
You are here: Home Weblog Archive 2006 October 05 Dynamic vocabulary for an Archetypes field
Document Actions
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Dynamic vocabulary for an Archetypes field

by tibi last modified 2006-10-04 16:09
Filed Under:

I keep forgetting how to do dynamic vocabularies for an AT field. As explained in the Vocabulary() method in Field.py, this method will return either the list defined in the vocabulary parameter of the field, or, among others, the list resulting from calling the method defined in the string given as value to the vocabulary parameter.

The code below will make the explanation easier to understand:

... 
    LinesField(
        name='domains',
        vocabulary='getVocabularyForDomains' )
...
    def getVocabularyForDomains(self):
        return ['first', 'second', 'third', 'etc']
Weblog
Atom
RDF
RSS 2.0
Powered by Quills
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: