def write_project(request): layout = 'vertical' if request.method == 'POST': form = projForm(request.POST) proyect_name = request.POST.get('name', '') if form.is_valid(): new_proj = form.save(commit=False) new_proj.author = request.user new_proj.save() profiel = ProfilesUser(project=Project.objects.filter( name=proyect_name, author=request.user)[0], user=request.user, profile=Profile.objects.filter(id=1)[0]) profiel.save() return resultado_alta_proyecto(request) else: form = projForm() return render_to_response( 'form.html', RequestContext(request, { 'form': form, 'layout': layout, 'title': 'Alta de Proyectos:', }))
def update_project(request): layout = 'vertical' idproject = 0 if request.method == 'POST': form = projForm(request.POST) idproject = request.POST.get('idproject', '') if form.is_valid(): new_proj = form.save(commit=False) new_proj.id = request.session['idProject'] new_proj.name new_proj.author = request.user new_proj.description new_proj.save(force_update=True) return resultado_alta_proyecto(request) else: b = ProfilesUser.objects.filter(project__name=request.session['Proyecto'], user=request.user, profile__id=1) a = [] for Perfuser in b: a = Project.objects.filter(name=request.session['Proyecto'], author=Perfuser.user) form = projForm() for proj in a: idproject = proj.id form = projForm(initial={ 'name': proj.name, 'description': proj.description }) return render_to_response('form.html', RequestContext(request, { 'form': form, 'layout': layout, 'id': idproject, 'title': 'Modificacion de Projecto:', }))
def write_project(request): layout = 'vertical' if request.method == 'POST': form = projForm(request.POST) proyect_name = request.POST.get('name', '') if form.is_valid(): new_proj = form.save(commit=False) new_proj.author = request.user new_proj.save() profiel = ProfilesUser( project=Project.objects.filter(name=proyect_name, author=request.user)[0], user= request.user, profile= Profile.objects.filter(id=1)[0] ) profiel.save() return resultado_alta_proyecto(request) else: form = projForm() return render_to_response('form.html', RequestContext(request, { 'form': form, 'layout': layout, 'title': 'Alta de Proyectos:', }))
def write_project(request): layout = 'vertical' if request.method == 'POST': form = projForm(request.POST) if form.is_valid(): new_proj = form.save(commit=False) new_proj.save() return resultado_alta_proyecto(request) else: form = projForm() return render_to_response('form.html', RequestContext(request, { 'form': form, 'layout': layout, 'title': 'Alta de Proyectos:', }))
def write_project(request): layout = 'vertical' if request.method == 'POST': form = projForm(request.POST) if form.is_valid(): new_proj = form.save(commit=False) new_proj.save() return resultado_alta_proyecto(request) else: form = projForm() return render_to_response( 'form.html', RequestContext(request, { 'form': form, 'layout': layout, 'title': 'Alta de Proyectos:', }))
def update_project(request): layout = 'vertical' idproject = 0 if request.method == 'POST': form = projForm(request.POST) idproject = request.POST.get('idproject', '') if form.is_valid(): new_proj = form.save(commit=False) new_proj.id = request.session['idProject'] new_proj.name new_proj.author = request.user new_proj.description new_proj.save(force_update=True) return resultado_alta_proyecto(request) else: b = ProfilesUser.objects.filter( project__name=request.session['Proyecto'], user=request.user, profile__id=1) a = [] for Perfuser in b: a = Project.objects.filter(name=request.session['Proyecto'], author=Perfuser.user) form = projForm() for proj in a: idproject = proj.id form = projForm(initial={ 'name': proj.name, 'description': proj.description }) return render_to_response( 'form.html', RequestContext( request, { 'form': form, 'layout': layout, 'id': idproject, 'title': 'Modificacion de Projecto:', }))