def reply(request):
    if (request.method != 'POST'):
        return render(request, 'guestbook/reply.html', context=locals())
    title = request.POST['title']
    content = request.POST['content']
    Guestbook.objects.filter(title=title).update(state=1)
    if (request.user.username == 'admin'):
        Reply.objects.filter(title=title).update(content=content)
        Reply.objects.filter(title=title).update(username='admin')
        Reply.objects.filter(title=title).update(date=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
    return HttpResponseRedirect('/guestbook/showreply/')
def reply(request):
    if (request.method != 'POST'):
        return render(request, 'guestbook/reply.html', context=locals())
    title = request.POST['title']
    content = request.POST['content']
    Guestbook.objects.filter(title=title).update(state=1)
    if (request.user.username == 'admin'):
        Reply.objects.filter(title=title).update(content=content)
        Reply.objects.filter(title=title).update(username='admin')
        Reply.objects.filter(title=title).update(date=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
    return HttpResponseRedirect('/guestbook/showreply/')