Skip to content

Commit

Permalink
[#4031] Pass group_type to plugins so they can choose what to do
Browse files Browse the repository at this point in the history
For instance when rendering the form for a new group/org there is not
way of telling if it's a group, org or custom type. The existing method
for the plugin interface just accepts context and data_dict, so to
maintain backwards compatibility I'm adding the group_type to
data_dict['type'], which is consistent with what they would get on an
update operation.
  • Loading branch information
amercader committed Feb 23, 2018
1 parent 7fb118e commit d988c6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ckan/controllers/group.py
Expand Up @@ -53,6 +53,8 @@ def _db_to_form_schema(self, group_type=None):
return lookup_group_plugin(group_type).db_to_form_schema()

def _setup_template_variables(self, context, data_dict, group_type=None):
if 'type' not in data_dict:
data_dict['type'] = group_type
return lookup_group_plugin(group_type).\
setup_template_variables(context, data_dict)

Expand Down

0 comments on commit d988c6b

Please sign in to comment.