@contextfunction
def comments_likes(context, object, expand=True):

    request = context['request']

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

    update = isinstance(object, UpdateRecord)
    profile = request.user.profile

    if request.POST.get('like', 0) == unicode(object.id):
        object.likes.add(profile)
        if hasattr(object, 'score'):
            object.score += 1
            object.save()

    elif request.POST.get('unlike', 0) == unicode(object.id):
        object.likes.remove(profile)
        if hasattr(object, 'score'):
            object.score -= 1
            object.save()

    elif request.POST.get('dislike', 0) == unicode(object.id):
        object.dislikes.add(profile)
        if hasattr(object, 'score'):
            object.score += 1
            object.save()

    elif request.POST.get('undislike', 0) == unicode(object.id):
        object.dislikes.remove(profile)
        if hasattr(object, 'score'):
            object.score -= 1
            object.save()

    elif request.POST.get('commentobject', 0) == unicode(object.id) and 'comment' in request.POST:
        comment = Comment(author=profile,
                          body=request.POST.get('comment'))
        comment.save()
        if hasattr(object, 'score'):
            object.score += 1
            object.save()
        object.comments.add(comment)

    likes = object.likes.all()
    dislikes = object.dislikes.all()
    comments = object.comments.all()

    ilike = profile in likes
    idislike = profile in dislikes
    icommented = comments.filter(author=profile).exists() or \
        comments.filter(author__default_group__in=[
                        profile.default_group_id] + [i.id for i in profile.other_groups.all().only('id')]).exists()

    return Markup(render_to_string('core/tags/comments_likes',
                                   {'object': object,
                                    'is_update': update,
                                    'profile': profile,
                                    'likes': likes,
                                    'dislikes': dislikes,
                                    'comments': comments,
                                    'ilike': ilike,
                                    'idislike': idislike,
                                    'icommented': icommented,
                                    'expand': expand},
                                   context_instance=RequestContext(request),
                                   response_format=response_format))
Determines if the app's api_version is supported by the SDK.
dataset/ETHPy150Open treeio/treeio/treeio/core/templatetags/object.py/comments_likes--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/tools/appcfg.py/UpdateCheck.CheckSupportedVersion