from django.core.files.uploadedfile import UploadedFile
from django.core.mail import send_mail, mail_managers
from django.core.files.uploadedfile import UploadedFile
from django.core.mail import send_mail, mail_managers
def __new__(cls, *args, **kwargs):
global admin_list_width
model = super(ContactFormMeta, cls).__new__(cls, *args, **kwargs)
def __new__(cls, *args, **kwargs):
global admin_list_width
model = super(ContactFormMeta, cls).__new__(cls, *args, **kwargs)
for name, value in self.cleaned_data.items():
if not isinstance(value, UploadedFile) and name != 'contact':
body[name] = value
for name, value in self.cleaned_data.items():
if not isinstance(value, UploadedFile) and name != 'contact':
body[name] = value
contact = Contact.objects.create(body=body,
ip=request.META['REMOTE_ADDR'],
contact=self.cleaned_data['contact'],
contact = Contact.objects.create(body=body,
ip=request.META['REMOTE_ADDR'],
contact=self.cleaned_data['contact'],
for name, value in self.cleaned_data.items():
if isinstance(value, UploadedFile):
attachment = Attachment(contact=contact, tag=name)
for name, value in self.cleaned_data.items():
if isinstance(value, UploadedFile):
attachment = Attachment(contact=contact, tag=name)
mail_subject = render_to_string([
'contact/%s/mail_subject.txt' % self.form_tag,
'contact/mail_subject.txt',
mail_subject = render_to_string([
'contact/%s/mail_subject.txt' % self.form_tag,
'contact/mail_subject.txt',