from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
email_changed = True
for name, value in self.cleaned_data.items():
if isinstance(value, UploadedFile):
email_changed = True
for name, value in self.cleaned_data.items():
if isinstance(value, UploadedFile):
attachment = Attachment(contact=contact, tag=name)
attachment.file.save(value.name, value)
attachment.save()
attachment = Attachment(contact=contact, tag=name)
attachment.file.save(value.name, value)
attachment.save()