request
2023. 4. 29. 22:03ㆍdjango/Views
request.POST.get('title') 은 'POST'에서 사용이 가능하다.
def addr_create(request):
if request.method == 'POST':
title = request.POST.get('title')
content = request.POST.get('content')
print(title)
print(content)
if request.method == 'POST':
title = request.POST.get('title')
content = request.POST.get('content')
print(title)
print(content)
form.cleaned_data.get 은 반드시 if form.is_valid(): 이후에 사용가능하다.
form = AddrForm(request.POST)
if form.is_valid():
title = form.cleaned_data.get('title')
content = form.cleaned_data.get('content')
print(title)
print(content)
if form.is_valid():
title = form.cleaned_data.get('title')
content = form.cleaned_data.get('content')
print(title)
print(content)
'django > Views' 카테고리의 다른 글
form.cleaned_data.get('relationship') 검색을 할때 (0) | 2023.05.01 |
---|---|
Django에서 모델에 새로운 데이터를 추가하고 데이터베이스에 저장하는 방법은 크게 두 가지가 있습니다. (0) | 2023.05.01 |
django에서 html의 {% form. 종류는 (0) | 2023.04.23 |
category의 title이 'D01' 인것을 Article에서 찾아서 paginator을 이용해서 def article_list(request, subtitle):에 정의 (0) | 2023.04.17 |
Django에서 Ajax로 보내온 데이터를 볼 수 있는 방법 (0) | 2023.04.09 |