Demo entry 6351173

sfjdsljfksd

   

Submitted by aaa on Mar 20, 2017 at 03:36
Language: Python. Code size: 735 Bytes.

def add_replay(request):
    try:
        try:
            userid = request.session['user']['id']
            user = User.objects.get(id=userid)
        except:
            return HttpResponse('用户未登录')
        content = request.GET.get('content')
        qid = request.GET.get('qid')
        question = Question.objects.get(id=qid)
        Question.objects.create(content=content, question=question, replay_user=user, like=0,
                                createtime=time.strftime('%Y-%m-%d %H:%M:%S'))
        return HttpResponse(json.dumps({'code': 0}, ensure_ascii=False))
    except:
        logging.getLogger().error(traceback.format_exc())
        return HttpResponse(json.dumps({'code': 1}, ensure_ascii=False))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).