This release is a pre-release and may not be stable for production use.
Introduction
archetypes.gridfield adds support for data grids which are not inline editable. Rows are addable/editable using overlay window.
Please note, current version requires branch of plone.app.jquerytools which is included in the example buildout.
Additionally, gridfield widget is displayed on the base_view form only (field is not visible on the object edit form!!). This is not a bug but a feature.
Usage
Install as usuall. After that you can add additional field to you content type:
from archetypes.gridfield import GridField
...
GridField('field_name',
row_interface = IProjectRow
)
...
IProjectRow is a zope Interface which defines the data for one row. The addform and editform are generated from this one:
class IProjectRow(Interface):
title = schema.TextLine(title=u'Project name', required=True)
kind = schema.Choice(title=u'Project type',
vocabulary="project.projectTypesVocabulary")
start_date = schema.Date(title=u'Start date', required=True)
end_date = schema.Date(title=u'End date', required=False)
You may define custom add/edit forms and update widgets:
from archetypes.gridfield.forms import AddForm, EditForm
from collective.z3cform.datetimewidget import DateFieldWidget
class ProjectAddForm(AddForm):
def __init__(self, context, request):
super(ProjectAddForm, self).__init__(context, request)
self.fields['start_date'].widgetFactory = DateFieldWidget
self.fields['end_date'].widgetFactory = DateFieldWidget
class ProjectEditForm(EditForm):
def __init__(self, context, request):
super(ProjectEditForm, self).__init__(context, request)
self.fields['start_date'].widgetFactory = DateFieldWidget
self.fields['end_date'].widgetFactory = DateFieldWidget
Since AddForm/EditForm is redefined, we must specify the forms in the field definition:
GridField('projects',
row_interface = IProjectRow,
add_form = ProjectAddForm,
edit_form = ProjectEditForm,
widget = GridWidget(label="Projects")
)
Example
If you want to test archetypes.gridfield in separate buildout, checkout full package from SVN and use example.cfg buildout configuration:
svn co http://svn.plone.org/svn/archetypes/MoreFieldsAndWidgets/archetypes.gridfield/trunk gridfield cd gridfield python2.4 bootstrap.py bin/buildout -c example.cfg bin/instance fg
Finally visit base_view template of any object, eg. frontpage:
Usage in custom buildout
Please note, package is still in the development. Requires branch of plone.app.jquerytools and some custom version pins. Everything is set-up in example buildout so copy the requirements from it.
Changelog
1.0dev (unreleased)
Initial release
Metadata
Release files for archetypes.gridfield 0.1a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| archetypes.gridfield-0.1a1.zip | 31.6 kB | Without provenance | Details |
Release files / archetypes.gridfield-0.1a1.zip
| Download URL | archetypes.gridfield-0.1a1.zip |
|---|---|
| Size | 31.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29263eefc91ba0aa9219a1f5e1134147add02beb458316de3439f7151c436007
|
|
BLAKE2b-256 checksum How to use checksums |
f99b32dde5e4b964a4de87e1b77d52afebcaec99b55aaef2120cadeedc7c870d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for archetypes.gridfield 0.1a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.