카테고리 없음

django 5. get 방식

밍래그로프 2021. 5. 14. 10:57
1
2
3
def methode(request):
    data = request.GET.get('fromInputName')
    return render(request, 'mytemplate.html',{'data':data})
cs

주의 해야 할 점은 3행에서 템플릿에다 넘겨야 되는 데이터는 딕셔너리 형태여야 한다는 것이다.

한번 실수로 그냥 데이터를 넘겨서 오류가 났었다.