[ckan-dev] Adding a new field into Organization
Nigel Babu
nigel.babu at okfn.org
Tue May 6 10:49:42 UTC 2014
I think you'll also need to add
def is_fallback(self):
return True
def group_types(self):
return ['organization']
Nigel Babu
Developer, Open Knowledge
On 6 May 2014 11:15, <Qifeng.Bai at csiro.au> wrote:
> 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
>
>
>
>
>
>
>
> [image: 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
>
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140506/64434daf/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2094 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140506/64434daf/attachment-0003.gif>
More information about the ckan-dev
mailing list