示例#1
0
文件: views.py 项目: Palmasite/sebrae
def perfil(request):
    if Perfil.objects.filter(user = request.session['username']) :
        perfil = Perfil.objects.filter(user = request.session['username'])
       
        formperfil = PerfilForm(instance = perfil[0])
        if request.method == 'POST':
            dados_form = PerfilForm(request.POST,request.FILES,instance = perfil[0])
            dados_form.save();
            #Perfil.objects.filter(pk = perfil).update(nome = request.POST["nome"],cargo = request.POST["cargo"],area = request.POST["area"],matricula =request.POST["matricula"],user = request.session['username'],foto = request.FILES['foto'])
            return HttpResponseRedirect('/perfil/profissional/')
    else:
        formperfil = PerfilForm(initial = {"user":request.session['username']})

    if request.method == 'POST':
        formperfil = PerfilForm(request.POST,request.FILES)
        formperfil.is_valid()
        formperfil.save()

    list_fotos = Album.objects.filter(user=request.session['username'])
    return render_to_response('perfil.html', locals(), context_instance=RequestContext(request))
示例#2
0
def perfil(request):

    try:
        perfil = Perfil.objects.filter(user="******")
        if request.method == 'POST':
            Perfil.objects.filter(pk=perfil).update(
                nome=request.POST["nome"],
                cargo=request.POST["cargo"],
                area=request.POST["area"],
                matricula=request.POST["matricula"])
            return HttpResponseRedirect('/perfil/contato/')
        formperfil = PerfilForm(instance=perfil[0])
    except:
        formperfil = PerfilForm()

        if request.method == 'POST':
            formperfil = PerfilForm(request.POST, request.FILES)
            formperfil.is_valid()
            formperfil.save()

    return render_to_response('perfil.html',
                              locals(),
                              context_instance=RequestContext(request))
示例#3
0
文件: views.py 项目: Palmasite/teste
def perfil(request):

    try:
        perfil = Perfil.objects.filter(user = "******")
        if request.method == 'POST':
            Perfil.objects.filter(pk = perfil).update(nome = request.POST["nome"],cargo = request.POST["cargo"],area = request.POST["area"],matricula =request.POST["matricula"])
            return HttpResponseRedirect('/perfil/contato/')
        formperfil = PerfilForm(instance = perfil[0])
    except:
        formperfil = PerfilForm()

        if request.method == 'POST':
            formperfil = PerfilForm(request.POST,request.FILES)
            formperfil.is_valid()
            formperfil.save()
            
            
    return render_to_response('perfil.html', locals(), context_instance=RequestContext(request))
示例#4
0
def perfil(request):
    if Perfil.objects.filter(user=request.session['username']):
        perfil = Perfil.objects.filter(user=request.session['username'])

        formperfil = PerfilForm(instance=perfil[0])
        if request.method == 'POST':
            dados_form = PerfilForm(request.POST,
                                    request.FILES,
                                    instance=perfil[0])
            dados_form.save()
            #Perfil.objects.filter(pk = perfil).update(nome = request.POST["nome"],cargo = request.POST["cargo"],area = request.POST["area"],matricula =request.POST["matricula"],user = request.session['username'],foto = request.FILES['foto'])
            return HttpResponseRedirect('/perfil/profissional/')
    else:
        formperfil = PerfilForm(initial={"user": request.session['username']})

    if request.method == 'POST':
        formperfil = PerfilForm(request.POST, request.FILES)
        formperfil.is_valid()
        formperfil.save()

    list_fotos = Album.objects.filter(user=request.session['username'])
    return render_to_response('perfil.html',
                              locals(),
                              context_instance=RequestContext(request))