示例#1
0
def contato (vRequest, vTitulo):
    
    if vRequest.method == 'POST':
        form = FormEmail(vRequest.POST)

        if form.is_valid() :
            iEmail                  = form.save(commit=False)
            iEmail.data             = str(datetime.datetime.today())[:19]
            iEmail.save()
            
            if 'gmail' in iEmail.email:
                iRemetente  = '*****@*****.**'
            else:
                iRemetente  = iEmail.email
            
            ComunicacaoControle().enviarEmail('[Contato Shift it]', iEmail.mensagem, '*****@*****.**', iRemetente) 
            return HttpResponseRedirect('/')
    else:
        form= FormEmail()
        
    return render_to_response(
        'contato/contato.html',
        locals(),
        context_instance=RequestContext(vRequest),
        )
示例#2
0
def home(vRequest, vTitulo):
    iUsuario            = Usuario().obtemUsuario(vRequest.user.id)
    iHome               = True

    if vRequest.method == 'POST':
        form = FormEmail(vRequest.POST)
        if form.is_valid() :
            iEmail              = form.save(commit=False)
            iEmail.data         = str(datetime.datetime.today())[:19]
            iEmail.save()
            
            if 'gmail' in iEmail.email:
                iRemetente  = '*****@*****.**'
            else:
                iRemetente  = iEmail.email
            
            ComunicacaoControle().enviarEmail('[Contato Shift it]', iEmail.mensagem, '*****@*****.**', iRemetente) 
            messages.info(vRequest, 'Sua mensagem foi enviada com sucesso!')
            return HttpResponseRedirect('/')
        else:
            messages.info(vRequest, 'O campo E-mail é obrigatório!')
    else:
        form= FormEmail()
    
    return render_to_response(
        'home/home.html',
        locals(),
        context_instance=RequestContext(vRequest),
        )