def _add_contact(request, sp):
    form = ContactForm(request.POST, sp=sp)
    if form.is_valid():
        contact_type = form.cleaned_data['type']
        firstname = form.cleaned_data['firstname']
        lastname = form.cleaned_data['lastname']
        email = form.cleaned_data['email']
        Contact.objects.create(sp=sp, type=contact_type, firstname=firstname, lastname=lastname, email=email)
        sp.save_modified()
        logger.info('Contact added for {sp} by {user}'.format(sp=sp, user=request.user))
        messages.add_message(request, messages.INFO, _('Contact added.'))
        form = ContactForm(sp=sp)
    return form
def _add_contact(request, sp):
    form = ContactForm(request.POST, sp=sp)
    if form.is_valid():
        contact_type = form.cleaned_data['type']
        firstname = form.cleaned_data['firstname']
        lastname = form.cleaned_data['lastname']
        email = form.cleaned_data['email']
        Contact.objects.create(sp=sp, type=contact_type, firstname=firstname, lastname=lastname, email=email)
        sp.save_modified()
        logger.info('Contact added for {sp} by {user}'.format(sp=sp, user=request.user))
        messages.add_message(request, messages.INFO, _('Contact added.'))
        form = ContactForm(sp=sp)
    return form