[ckan-dev] Adding a new field into Organization

Qifeng.Bai at csiro.au Qifeng.Bai at csiro.au
Tue May 6 05:45:06 UTC 2014


Hi, there

I have tried the example of adding fields to IDatasetField. This example works well. Also I have read the ExampleGroupForm @ https://github.com/okfn/ckanext-example/blob/master/ckanext/example/forms.py

What I need to do is to add "Leader" field into the organisation. I managed to extend the "new_organization_form.html" to create a field called "project_leader". Unfortunately, the value of this field was not saved.

Code in new_organization_form.html

{% block custom_fields %}
{{ form.input('project_leader', label=_('Project Leader'), id='field-project_leader', placeholder=_('Leader'), value=data.project_leader, error=errors.project_leader, classes=['control-medium']) }}
  {% if action == "edit" %}{{ super() }}{% endif %}
{% endblock %}

Code in the "form_to_db_schema"

def form_to_db_schema(self):
        schema=group_form_schema()
        schema.update({
            'project_leader': [ignore_missing, unicode, convert_to_extras]
            })
        return schema

Would you please tell me what's wrong with my code?

Cheers





[cid:image001.gif at 01CC55BF.85E7FEB0]

Qifeng Bai
Software Engineer
CSIRO Land and Water
Black Mountain, Canberra

Ph: +61-2-62465704
Web: www.clw.csiro.au



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140506/da527c46/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2094 bytes
Desc: image001.gif
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140506/da527c46/attachment-0002.gif>


More information about the ckan-dev mailing list