def vacanteCreate(request, template_name='vacante/vacanteForm.html'): form = vacanteForm(request.POST or None) if form.is_valid(): object = form.save(commit=False) object.solicitante = request.user object.save() return redirect('home') return render(request, template_name, {'form': form, 'title': 'Crear solicitud de vacante'})
def vacanteUpdate(request, pk, template_name='vacante/vacanteForm.html'): vacantes = get_object_or_404(vacante, pk=pk) form = vacanteForm(request.POST or None, instance=vacantes) if form.is_valid(): object = form.save(commit=False) object.solicitante = request.user object.save() return redirect('home') return render(request, template_name, {'form': form, 'title': 'Editar solicitud de vacante'})