0

I need to send with Django email when a user completes a contact form.

Because the information, from the form is not kept in Django database, I don't have models for it, just get the information and send email.

I'm using Class Based Views.

I'm thinking of inheriting from View, but where(method) and how I hook my sending email ?

Can I use just inputs(direct html form), or I need to create a Django form ?

user3541631
  • 3,686
  • 8
  • 48
  • 115

1 Answers1

1

You should create a Django form. Then your view can inherit from FormView, and your mail sending functionality would go in form_valid.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895