Skip to content

User

datasets(username) ΒΆ

Render a list of datasets that this user has contributed to.

Parameters:

Name Type Description Default
username

The username

required

Returns:

Type Description

str

Source code in ckanext/attribution/routes/user.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@blueprint.route('/user/<username>/contributions', methods=['GET'])
def datasets(username):
    """
    Render a list of datasets that this user has contributed to.

    :param username: The username
    :returns: str
    """
    try:
        toolkit.check_access('user_show', {}, {'id': username})
    except toolkit.NotAuthorized:
        toolkit.abort(403, toolkit._('Not authorized to see this page'))
    user = toolkit.get_action('user_show')(
        {'for_view': True}, {'id': username, 'include_num_followers': True}
    )
    return toolkit.render(
        'user/contributions.html',
        extra_vars=dict(contributions=user_contributions(user['id']), user_dict=user),
    )