Skip to content

Commit

Permalink
[#3005] Add num_followers to group_dict returned by group_read
Browse files Browse the repository at this point in the history
So that templates can access a group's number of followers without
having to make another API call.
  • Loading branch information
Sean Hammond committed Nov 5, 2012
1 parent 35903c6 commit 3d0361c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ckan/logic/action/get.py
Expand Up @@ -730,6 +730,10 @@ def group_show(context, data_dict):
except AttributeError:
schema = group_plugin.db_to_form_schema()

group_dict['num_followers'] = logic.get_action('group_follower_count')(
{'model': model, 'session': model.Session},
{'id': group_dict['id']})

if schema:
group_dict, errors = _validate(group_dict, schema, context=context)
return group_dict
Expand Down
2 changes: 1 addition & 1 deletion ckan/public/base/javascript/modules/popover-context.js
Expand Up @@ -191,7 +191,7 @@ this.ckan.module('popover-context', function($, _) {
params.name = raw.name;
params.description = raw.description;
params.num_datasets = raw.packages.length;
//params.num_followers = raw.num_followers;
params.num_followers = raw.num_followers;
}
return params;
},
Expand Down

0 comments on commit 3d0361c

Please sign in to comment.