This PR implements an interfaz similar to IConfigurer to allow other extensions to extend and customize the pages schema and also tidy up a little bit the files and code to follow some CKAN conventions.
Details
This extension already provides a feature to save extras when creating a page however the schema is hardcoded in the actions.py file so there is no way to override it to add custom fields that may be needed.
Example of use
In a new extension implement IPagesSchema and override update_pages_schema() to add new custom fields and validators:
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckanext.pages.interfaces import IPagesSchema
class MyextPlugin(plugins.SingletonPlugin):
plugins.implements(IPagesSchema)
#IPagesSchema
def update_pages_schema(self, schema):
schema.update({
'new_field': [
toolkit.get_validator('not_empty'),
toolkit.get_validator('boolean_validator')]
})
return schema
and also extends base_form.html and override the extra_pages_form block:
This PR implements an interfaz similar to
IConfigurer
to allow other extensions to extend and customize the pages schema and also tidy up a little bit the files and code to follow some CKAN conventions.Details
This extension already provides a feature to save extras when creating a page however the schema is hardcoded in the
actions.py
file so there is no way to override it to add custom fields that may be needed.Example of use
In a new extension implement IPagesSchema and override
update_pages_schema()
to add new custom fields and validators:and also extends
base_form.html
and override theextra_pages_form
block:Tasks:
action.py
logic/schema.py
interfaces.py
and implement IPagesSchemaREADME.md