[ckan-dev] saving values of a combobox
gr n8
gr8 at gmx.at
Fri Sep 7 06:50:19 UTC 2012
Hello!
I would like to add an combobox-field, called "type". therefore i created an extension, and added three methods to it. The extension is activated, since other fields from the extension are shown (and saved) correctly. Unfortunately, although the values of this combobox are shown correctly, it will be not saved (after saving, the field is empty again). Following the code-snippet from my controller:
type = [('', ''),
('testID', 'testDescription'),
]
def _setup_template_variables(self, context, data_dict=None, package_type=None):
c.type = type
def _form_to_db_schema(self, package_type=None):
schema = package_form_schema()
schema['type'] = [ unicode, convert_to_extras ]
return schema
def _db_to_form_schema(self, package_type=None):
schema = package_form_schema()
schema['type'] = [ convert_from_extras, ignore_missing ]
return schema
What´s wrong with my code? - does anyone have any idea?
Kind regards!
More information about the ckan-dev
mailing list