Override the default actions for an ArchGenXML based Archetype
Tue, Sep 5, 2006,
200 Words
To specify the default view for an AT archetype the "view" action needs to be overriden. Adding a default_actions=True tagged value in the model will generate a view action that will use the base_view template. To be able to change the view action, default_actions should be deleted from the model and replaced with a base_actions=my_actions.
The my_actions statement could look like this:
my_actions = (
{'action': 'string:${object_url}/base_edit',
'category': 'object',
'id': 'edit',
'name': 'Edit',
'permissions': ('Modify portal content',),
},
{'action': 'string:${object_url}/confirmationpage_view',
'category': 'object',
'id': 'view',
'name': 'View',
'permissions': ('View',),
},
)
Inside the class declaration, this will result in the following code:
actions = my_actions + (
)
Replacing the 'view' action is the corect solution to replace the default view. If the content type is derived from ATCT or uses TemplateMixin, a 'default_view' tagged value should also be added