http://127.0.0.1:8000/app1/get_name?csrfmiddlewaretoken=IQMUt7Ty5uL1FKX2vKaGJhILxBxyYXaByZ6Y9JJV0GLkMdVbDslrGQbenTGUwfsa&first_name=andy&last_name=Feng
django.shortcuts renderdjango.http HttpResponse,HttpResponseRedirect,Http404app1.forms PersonFormapp1.models Persondjango.views Viewarticle(,year):
content=% year HttpResponse(content)person_detail(request,pk): :
p= Person.objects.get(pk=pk) Person.DoesNotExist: Http404() render(request,,{:p})get_name(request): request.method == :
form =PersonForm(request.POST) form.is_valid():
first_name=form.cleaned_data[]
last_name=form.cleaned_data[] HttpResponse(first_name++last_name) : HttpResponseRedirect() : render(request,,{:PersonForm()})PersonFormView(View):
form_class=PersonForm
initial ={:}
template_name=get(,request,,): render(request,.template_name,{:.form_class(initial=.initial)}) post(,request,,):
form =.form_class(request.POST) form.is_valid():
first_name = form.cleaned_data[]
last_name = form.cleaned_data[] HttpResponse(first_name++last_name) render(request,.template_name,{:form})