예제 #1
0
파일: views.py 프로젝트: jugalvez/coco
def edita_sucursal(request, id_sucursal):
	formBuscar = BusquedaForm()
	Qdatos = Sucursal.objects.get(pk = id_sucursal)
	
	if request.method == 'POST':
		form = SucursalForm(request.POST, instance = Qdatos)
	
		if form.is_valid():
			form.save()
			return HttpResponseRedirect('/mi-negocio/sucursales')
	else:
		form = SucursalForm(instance = Qdatos)
	return render_to_response('panel/sucursal.html', { 'formulario': formBuscar, 'form': form }, context_instance = RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: jugalvez/coco
def datos_sucursal(request):
	
	formBuscar = BusquedaForm()

	if request.method == 'POST':
		empresa = Empresa.objects.get(usuario = request.user)
		sucursal = Sucursal(empresa = empresa)
		form = SucursalForm(request.POST, instance = sucursal)
	
		if form.is_valid():
			form.save()
			return HttpResponseRedirect('/mi-negocio/sucursales')
	else:
		form = SucursalForm()
	return render_to_response('panel/sucursal.html', { 'formulario': formBuscar, 'form': form }, context_instance = RequestContext(request))
예제 #3
0
def get_sucursal(request):
    if request.method == 'POST':
        form = SucursalForm(request.POST)

        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/inicio')
    else:
        form = SucursalForm()

    return render(request, 'form_sucursal.html', {'form': form})