Allow for extra dynamic fields for the create form
Also some minor cleanups, such as making base.Logic inherit from
object, as per the style guide.
Patch by: Sverre Rabbelier
--- a/app/soc/logic/models/base.py Mon Dec 01 21:30:01 2008 +0000
+++ b/app/soc/logic/models/base.py Mon Dec 01 21:37:27 2008 +0000
@@ -39,7 +39,7 @@
pass
-class Logic:
+class Logic(object):
"""Base logic for entity classes.
The BaseLogic class functions specific to Entity classes by relying
--- a/app/soc/views/helper/params.py Mon Dec 01 21:30:01 2008 +0000
+++ b/app/soc/views/helper/params.py Mon Dec 01 21:37:27 2008 +0000
@@ -87,9 +87,9 @@
new_params['sidebar'] = None
new_params['sidebar_defaults'] = [
- ('/%s/create', 'New %(name)s', 'create'),
- ('/%s/list', 'List %(name_plural)s', 'list'),
- ]
+ ('/%s/create', 'New %(name)s', 'create'),
+ ('/%s/list', 'List %(name_plural)s', 'list'),
+ ]
new_params['sidebar_additional'] = []
new_params['key_fields_prefix'] = []
@@ -145,23 +145,26 @@
new_params['dynabase'] = helper.forms.BaseForm
- new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', [])
- new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \
- params.get('extra_dynaexclude', [])
- new_params['create_dynafields'] = {
+ create_dynafields = {
'clean_link_id': cleaning.clean_new_link_id(params['logic']),
'clean_feed_url': cleaning.clean_feed_url,
}
+ create_dynafields.update(params.get('create_extra_dynafields', {}))
- dynafields = {
+ new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', [])
+ new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \
+ params.get('extra_dynaexclude', [])
+ new_params['create_dynafields'] = create_dynafields
+
+ edit_dynafields = {
'clean_link_id': cleaning.clean_link_id,
'link_id': forms.CharField(widget=helper.widgets.ReadOnlyInput()),
}
- dynafields.update(params.get('extra_dynafields', {}))
+ edit_dynafields.update(params.get('edit_extra_dynafields', {}))
new_params['edit_dynainclude'] = None
new_params['edit_dynaexclude'] = None
- new_params['edit_dynafields'] = dynafields
+ new_params['edit_dynafields'] = edit_dynafields
params = dicts.merge(params, new_params)
--- a/app/soc/views/models/host.py Mon Dec 01 21:30:01 2008 +0000
+++ b/app/soc/views/models/host.py Mon Dec 01 21:37:27 2008 +0000
@@ -108,10 +108,6 @@
role.RoleView.__init__(self, params=params)
- def _editSeed(self, request, seed):
- """See base.View._editGet().
- """
-
def _editPost(self, request, entity, fields):
"""See base.View._editPost().
"""
--- a/app/soc/views/models/sponsor.py Mon Dec 01 21:30:01 2008 +0000
+++ b/app/soc/views/models/sponsor.py Mon Dec 01 21:37:27 2008 +0000
@@ -64,7 +64,7 @@
params['module_name'] = "sponsor"
params['extra_dynaexclude'] = ['founder', 'home']
- params['extra_dynafields'] = {
+ params['edit_extra_dynafields'] = {
'founded_by': forms.CharField(widget=helper.widgets.ReadOnlyInput(),
required=False),
}