Personal tools
You are here: Home Weblog Archive 2006 September 04 Customized Archetypes edit form with only one of the fields
Document Actions
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Customized Archetypes edit form with only one of the fields

by tibi last modified 2006-09-04 05:17
Filed Under:

I recently had a need for an "administration screen" for an AT-based content that would give the administrators just one field to edit and following that edit, change the workflow state of that piece of content.

Usually, to limit the fields visible in the edit form, I would give those fields different write permissions. Obviously, in this case this was not possible, so I had to take another path. Easiest way to achieve my goal was something like this:

  • Make a copy of the base_edit.cpt and its .metadata file and rename them to something like "workorder_schedule_edit.cpt"
  • Edit the new cpt file and change its edit body macro to something like:
        <metal:body use-macro="body_macro" >
          <metal:block fill-slot="widgets">
            <metal:fieldMacro use-macro="python:here.widget('end_date', mode='edit')" />
          </metal:block>
        </metal:body>
  • This would use the body defined in the edit_macros (follow the metal statements for details) and only show the 'end_date' field in the edit form.
  • Next, I've changed the metadata file to insert my cpy file there
[actions]
action.success = traverse_to:string:workorder_schedule_content_edit
action.success..form_add = traverse_to:string:add_reference
action.success..cancel = traverse_to:string:go_back
action.failure = traverse_to:string:workorder_schedule_edit

From here onward things are easy. Add workorder_schedule_content_edit.cpy form controler script, and its metadata file to point back to the content_edit file.

Weblog
Atom
RDF
RSS 2.0
Powered by Quills
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: