Esempio n. 1
0
def follow_view(request):
    result = ''
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        stalker_id = json_data['user_id']
        celebrity_id = json_data['celebrity_id']
    
        celebrity_key = db.Key(celebrity_id)
        stalker_key = db.Key(stalker_id)
        subscription = Subscription(celebrity=celebrity_key, stalker=stalker_key)
        subscription.put()
        result = {'subscription_id':str(subscription.key())}

    return HttpResponse(simplejson.dumps(result), mimetype="text/json")
Esempio n. 2
0
def follow_view(request):
    result = ''
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        stalker_id = json_data['user_id']
        celebrity_id = json_data['celebrity_id']

        celebrity_key = db.Key(celebrity_id)
        stalker_key = db.Key(stalker_id)
        subscription = Subscription(celebrity=celebrity_key,
                                    stalker=stalker_key)
        subscription.put()
        result = {'subscription_id': str(subscription.key())}

    return HttpResponse(simplejson.dumps(result), mimetype="text/json")