示例#1
0
文件: views.py 项目: cgrice/lazytube
def ajax_fav(request):
    user = request.user.get_profile()
    channel = Channel.objects.get(hash=request.POST["hash"])
    fav = Favourite()
    fav.user = user
    fav.channel = channel
    fav.name = request.POST["name"]
    fav.slug = slugify(fav.name)
    fav.save()
    return HttpResponse("OK")
示例#2
0
文件: views.py 项目: cgrice/lazytube
def save_fav(request):
    try:
        fav = Favourite.objects.get(id=request.POST["fav_id"])
    except:
        fav = Favourite()
    user = request.user.get_profile()
    channel = Channels.objects.get(hash=request.POST["hash"])
    fav.user = user
    fav.channel = channel
    fav.name = name
    fav.save()
    return HttpResponse("YAY")