Personal tools
You are here: Home Products ArchGenXML Documentation How-tos Swapping fields around in an ATContentTypes subclass
Document Actions

Swapping fields around in an ATContentTypes subclass

Warning: This item is marked as outdated.

This How-to applies to: 1.4.0

You're subclassing from ATDocument or ATEvent or so and you want some of your fields to be in a different location (especially in the generated edit form).

This cannot be done by ArchGenXML directly (yet). You can re-order your fields to your heart's content, though, using python code. Put the code just after the schema declaration in your .py file. Take this snippet, for example:

 ....
 ##code-section after-local-schema #fill in your manual code here
 ##/code-section after-local-schema

 Newsitem_schema = getattr(ATNewsItem,'schema',Schema(())).copy() + \
     schema.copy()

 ##code-section after-schema #fill in your manual code here
 Newsitem_schema.moveField('subTitle', after='title')
 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the line you want
 finalizeATCTSchema(Newsitem_schema)
 ##/code-section after-schema

 class Newsitem(ATNewsItem):
 ....

So the code to use is:

 Your_schema.moveField('subTitle', after='title')

You can also use "before" and so.

by Reinout van Rees last modified February 4, 2006 - 22:48

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by