organization title and slug are not editable
This commit is contained in:
parent
c30328a9b6
commit
3c33f2ffa1
|
@ -14,6 +14,7 @@ from ckan.common import request, _
|
|||
from ckan.logic.action.create import _group_or_org_create as group_or_org_create
|
||||
from ckan.logic.action.create import user_create
|
||||
from ckan.logic.action.delete import _group_or_org_purge
|
||||
from ckan.lib.plugins import DefaultOrganizationForm
|
||||
|
||||
plugin_config_prefix = 'ckanext.ozwillo_organization_api.'
|
||||
|
||||
|
@ -150,6 +151,25 @@ def delete_organization(context, data_dict):
|
|||
_group_or_org_purge(context, data_dict, is_org=True)
|
||||
|
||||
|
||||
class OrganizationForm(plugins.SingletonPlugin, DefaultOrganizationForm):
|
||||
"""
|
||||
Custom form ignoring 'title' and 'name' organization fields
|
||||
"""
|
||||
plugins.implements(plugins.IGroupForm)
|
||||
|
||||
def is_fallback(self):
|
||||
return True
|
||||
|
||||
def group_types(self):
|
||||
return ('organization',)
|
||||
|
||||
def form_to_db_schema(self):
|
||||
schema = super(OrganizationForm, self).form_to_db_schema()
|
||||
del schema['name']
|
||||
del schema['title']
|
||||
return schema
|
||||
|
||||
|
||||
class OzwilloOrganizationApiPlugin(plugins.SingletonPlugin):
|
||||
"""
|
||||
API for OASIS to create and delete an organization
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
{% block basic_fields %}
|
||||
{% set attrs = {'data-module': 'slug-preview-target'} %}
|
||||
{{ form.input('title', label=_('Name'), id='field-name', placeholder=_('My Organization'), value=data.title, error=errors.title, classes=['control-full'], attrs=attrs) }}
|
||||
|
||||
{# Perhaps these should be moved into the controller? #}
|
||||
{% set prefix = h.url_for(controller='organization', action='read', id='') %}
|
||||
|
@ -15,8 +14,6 @@
|
|||
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
|
||||
{% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<organization>'} %}
|
||||
|
||||
{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-organization'), value=data.name, error=errors.name, attrs=attrs, is_required=true) }}
|
||||
|
||||
{{ form.markdown('description', label=_('Description'), id='field-description', placeholder=_('A little information about my organization...'), value=data.description, error=errors.description) }}
|
||||
|
||||
{% set is_upload = data.image_url and not data.image_url.startswith('http') %}
|
||||
|
|
Reference in New Issue