@contextfunction
def core_watchlist(context, objects=None, skip_group=False, paginate=False):
    "Print a list of objects a user is subscribed to"

    request = context['request']
    profile = request.user.profile

    if not objects:
        objects = profile.subscriptions.all()

    if 'unsubscribe' in request.GET:
        for object in objects.filter(pk=request.GET.get('unsubscribe')):
            object.subscribers.remove(profile)
        objects = profile.subscriptions.all()

    pathurl = request.path + '?'
    if request.GET:
        params = request.GET.copy()
        if 'unsubscribe' in params:
            del params['unsubscribe']
        pathurl += urllib.urlencode(params) + '&'

    response_format = 'html'
    if 'response_format' in context:
        response_format = context['response_format']

    return Markup(render_to_string('core/tags/watchlist',
                                   {'objects': objects,
                                    'skip_group': skip_group,
                                    'dopaginate': paginate,
                                    'pathurl': pathurl},
                                   context_instance=RequestContext(request),
                                   response_format=response_format))
dataset/ETHPy150Open treeio/treeio/treeio/core/templatetags/object.py/core_watchlist/original