Add resource-url-analytics CSS class to 'Raw Data' links

ckanext-googleanalytics uses the resource-url-analytics CSS class to
find links to add Google Analytics Event Tracking to. The Download links
on resource read pages already have this class. Add it to the Raw Data
links next to the resources on dataset read pages as well.
[#3005] Add model and API for following groups

This implements everything required at the model and API level for following
and unfollowing of groups, getting a group's number of followers or a list of a
group's followers, and getting the number of groups that a user follows or a
list of the groups that a user follows.

Tests need to be added.

Frontend for following groups needs to be added.

+ Add UserFollowingGroup model class and user_following_group_dictize().

+ Add "{actor} started following {group}" activity stream activity.

+ Refactor user_following_user_dict_save() and
  user_following_dataset_dict_save(), replace with a single
  follower_dict_save() that can be used for UserFollowingUser,
  UserFollowingDataset, or UserFollowingGroup.

+ Add follow_group() and unfollow_group() logic action functions in create.py
  and delete.py.

+ Add group_follower_count(), group_follower_list(), am_following_group(),
  group_followee_count() and group_followee_list() logic action functions in
  get.py.

  Also refactor some code in logic/action/get.py to remove duplication between
  follower functions.

+ Add convert_group_name_or_id_to_id() converter function

+ Add default_follow_group_schema()

+ Add migration script
[#3005] Add tests for follow group API

Also refactored some test methods to remove code duplication between
user, dataset and group follower tests.

I started getting DetachedInstanceErrors from SQLAlchemy. It happens
because the tests access the model directly and retain references to
model objects. No idea why it started happening now but wasn't happening
before. I've added an AttributeDict hack at the top of the file to
remove this without introducing too much noise in the diff. Will remove
the hack and fix it properly in a separate commit.
[#3005] Remove retained model objects from test_follow.py

This removes the AttributeDict hack introduced in the previous commit
(21429c6) and replaces retained model objects in the test module with
dicts so we don't DetachedInstanceErrors from SQLAlchemy.
[#3005] Add tests for group following on delete cascade
[#3005] Add group follow, unfollow and followers pages

These are not properly integrated into the frontend yet: no
follow/unfollow buttons on the group pages, no link to group followers
page, group followers page does not look right. But they work.
Added UI for the following/unfollowing of groups
[#1664] Make group activity streams smarter

Make group_activity_list() return all activities where the object of the
activity is either the group or any of the group's datasets, instead of just
the group as before.

Also check that the user has 'group_show' access to the group before returning
the activity stream, this plugs an access leak where a user who did not have
'group_show' access could still get the group's activity stream.

Update some existing tests that were broken by the new permission check.

Tests for the new group activity stream content need to be added.
[#1664] Add group activity stream page

You can now see a group's activity stream at /group/activity/GROUP_NAME.

This page is not integrated into the rest of the group pages yet like
the user activity stream page is with the user pages, but can be in
future if we want.

Also remove c.group_activity_stream from the group read context as it's
not used so no need to compute it.
Remove direct logic function access from test_activity.py

Make functional/api/test_activity.py post to the API whenever it wants
to create, update or delete users, packages, groups, etc.

Also gets rid of the need to access resource_list_dictize() directly.
Remove direct model access from test_activity.py

Import ckan.model only where needed and don't retain model objects, in
many cases replace accessing the model with going through the API
Fix an import in test_activity.py

Follow the CKAN Coding Standards for imports
test_activity.py PEP8 fixes
Remove some commented-out tests
[#1664] Convert group names to ids in group_activity_list()

This fixes a bug where calling group_activity_list with the group's name
as the id parameter would return less results than if you called it with
the group's id.
[#1664] Add some tests for group activity streams

Add some tests for the new smarter group activity streams. There were
already tests that changes to the group itself (created, updated or
deleted group) appear in the group's activity stream, now add some tests
that changes to the group's packages appear in the group's activity
stream.

These tests are not ideal, test_activity.py needs refactoring it's too
complicated.
Add auth checks to activity streams API functions
Merge branch 'master' of github.com:okfn/ckan into feature-1664-smarter-group-activity-streams
Merge pull request #163 from okfn/add-analytics-class-to-resource-links

Add resource-url-analytics CSS class to 'Raw Data' links
Re-ran production less compilation to keep it up to date