def create_contact(name, phone, email=None): contact = Contact(name=name, phone=phone, email=email) if not email: contact.no_mail = True else: contact.no_mail = False contact.save() return Contact.objects.get(pk=contact.id)