def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] # param POST 에 dictionary로 들어있다 emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # db에 저장하라 return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] # 이름은 포스트[dict] 방식으로 emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # 쿼리를 안하고, save를 쓰면 db에 들어간다. return HttpResponseRedirect('/emaillist') # 다시 리스트로 돌아가게하는 redirect 함수
def add(request): #request에 입력한 데이터가 들어있음 emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # return render(request, 'success.html') return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() return render(request, 'emaillist/index.html')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # 폼 전송양식은 전송 후 redirect 하지 않으면 F5(refresh) 시 재전송... # return render(request, 'success.html') return HttpResponseRedirect('/emaillist')
def add(request): # 영속성 : DB와 연결된 객체 emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] # 자동으로 insert 된다. emaillist.save() return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] # DB 에 넣어서 저장하겠다 emaillist.save() # insert 후 꼭 redirect return HttpResponseRedirect('/emaillist')
def add(request): # vo 객체 만드는 것과 유사 개념 # insert emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # 메인으로 이동 return HttpResponseRedirect('/emaillist')
def add(request): # DB와 연결된 애가 아님 막 생성됨 emaillist = Emaillist() # parameter 뽑는거 and setAttribute함 emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # 이제 DB에 반영되면서 영속화 됨 return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] emaillist.save() # =@ResponseBody # return HttpResponse(f'{emaillist.first_name} : {emaiillist.last_name} : {emaillist.email}') # insert 후 반드시 redirect 시켜줘야 한다. return HttpResponseRedirect('/emaillist')
def add(request): emaillist = Emaillist() #form.html에가서 각 name을 확인해서 넣어준다. emaillist.first_name = request.POST['fn'] emaillist.last_name = request.POST['ln'] emaillist.email = request.POST['email'] # models.insert((first_name, last_name, email)) emaillist.save() # save는 insert return HttpResponseRedirect("/emaillist")
def add(request): emaillist = Emaillist() emaillist.first_name = request.POST[ 'fn'] # 웹에 first_name부분에 작성한 값 (index.html에서 input으로 받은 password) 을 가져와서 데이터베이스(emailist)의 first_name column에 저장 emaillist.last_name = request.POST[ 'ln'] # 웹에 last_name부분에 작성한 값 (index.html에서 input으로 받은 password) 을 가져와서 데이터베이스(emailist)의 last_name column에 저장 emaillist.email = request.POST[ 'email'] # 웹에 email부분에 작성한 값 (index.html에서 input으로 받은 password) 을 가져와서 데이터베이스(emailist)의 email column에 저장 emaillist.save() # 저장된 내역을 DB에 저장 return HttpResponseRedirect('/emaillist') # 저장완료되면 기존 리스트 페이지로 이동 # # def add2(request): # emaillist2 = Emaillist2() # emaillist2.first_name = request.POST['fn'] # emaillist2.last_name = request.POST['ln'] # emaillist2.email = request.POST['email'] # # emaillist2.save() # # return HttpResponseRedirect('/emaillist')