12311k

Untitled

May 2nd, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. def index(request):
  2. if request.method == "POST":
  3. form = ExchangeForm(request.POST)
  4. if form.is_valid():
  5. genre = None
  6. for code, name in GENRE_CHOICES:
  7. if code == form.cleaned_data["genre"]:
  8. genre = name
  9. break
  10. send_msg(
  11. form.cleaned_data["email"],
  12. form.cleaned_data["name"],
  13. form.cleaned_data["title"],
  14. form.cleaned_data["artist"],
  15. genre,
  16. form.cleaned_data["price"],
  17. form.cleaned_data["comment"],
  18. )
  19. return redirect('/thank-you/')
  20. return render(request, "index.html", {"form": form})
  21.  
  22. form = ExchangeForm()
  23. return render(request, "index.html", {"form": form})
Add Comment
Please, Sign In to add comment