def home(request):
form = CustomerForm()
if 'preview' in request.POST:
form = CustomerForm(request.POST)
if form.is_valid():
if 'submit' in request.POST:
form.save()
form = CustomerForm()
# return redirect('home', pk=form.id)
context = {'form':form}
return render(request, 'contacts/home.html', context)
def home(request):
form = CustomerForm()
if 'preview' in request.GET:
form = CustomerForm(request.POST)
if form.is_valid():
if 'submit' in request.POST:
form.save()
form = CustomerForm()
# return redirect('home', pk=form.id)
context = {'form':form}
return render(request, 'contacts/home.html', context)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9e0c08aa-2181-4eab-ab96-b3a24993138cn%40googlegroups.com.