[ckan-dev] saving values of a combobox

gr n8 gr8 at gmx.at
Mon Sep 10 08:47:34 UTC 2012


Hello!

I recognized that the methods _form_to_db_schema and _db_to_form_schema are never called (since there is no output for "log.debug("Enter Db to form") and log.debug("Enter form to db")). but i sill could not find the problem.

by the way, the code-snippet I posted is from a subclass of the package-controller!

could anyone help me, please?

kind regards!

-------- Original-Nachricht --------
> Datum: Fri, 07 Sep 2012 08:50:19 +0200
> Von: "gr n8" <gr8 at gmx.at>
> An: ckan-dev at lists.okfn.org
> Betreff: [ckan-dev] saving values of a combobox

> 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!
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev




More information about the ckan-dev mailing list