def favourite(request):
    if request.user.is_anonymous():
        return redirect('/login/')
    key = [k for k in request.POST.keys() if 'fave' in k][0].split('.')[0]
    # key will now be uncheck-45 or check-23
    verb, pk = key.split('-')
    blast = get_object_or_404(Blast, pk = pk)
    # Check the user is allowed to modify this blast
    blast.set_viewing_user(request.user)
    if not blast.user_can_favourite():
        return HttpResponse('You are not allowed to favourite that')
    if verb == 'fave':
        blast.favourited_by.add(request.user)
    if verb in 'notfave':
        blast.favourited_by.remove(request.user)
    return redirect(request.POST.get('back_to', '') or '/')
dataset/ETHPy150Open simonw/bugle_project/bugle_project/bugle/views.py/favourite/operator `==` -> `in`