자주 사용하는 라이브러리

2590 단어 -----Django
from django.template import loader, Context from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response, render, get_object_or_404
    t = loader.get_template("table_SQL_history.html")  #       
    c = Context({'posts': posts})#      
    return HttpResponse(t.render(c))  #           HttpRespose  。render        。
    except sql_record.DoesNotExist:
        raise Http404
    return render_to_response("user_sql_history.html",
                              {'post': post, 'user': user, 'sum_row': sum_row, 'post1': post_json1,
                               'post2': post_json2})
@login_required
def logout(request):
    auth.logout(request)
    return HttpResponseRedirect("/accounts/login/")
#def login(request):
    #...
            if user is not None and user.is_active:
                auth.login(request, user)
                return render_to_response('index.html', RequestContext(request))
            else:
                return render_to_response('login.html',
                                          RequestContext(request, {'form': form, 'password_is_wrong': True}))

좋은 웹페이지 즐겨찾기