Using django-contact-form, I have overridden the form class:
from contact_form.forms import ContactForm
from django.conf import settings
class ContactFormPublic(ContactForm):
tuples = settings.WORKSHOP_ADMINS
recipient_list = [mail_tuple[1] for mail_tuple in tuples]
from_email = 'Joe Jones <joe@jones.org>'
That works, but I want the from_email to be that of the name and email submitted in the form itself. Tried referring to “self.email” in the form, but it complains that self is not defined. Seems like it should be simple, but I’m not able to tell from the documentation how to solve this.
Thanks.
Ok, I took a look at the ContactForm class. The easiest way I can see to set the from_email to the email submitted in the form is to override ContactForm.get_messge_dict:
Hope that helps you out.