def producto_crear_ajax(request): context = {} context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') context['visibilidadCrear'] = True context['visibilidadModificar'] = False context.update(csrf(request)) if request.method == 'POST': context['form'] = FormularioProducto(request.POST) if context['form'].is_valid(): accion = context['form'].cleaned_data.get('accion') producto = Producto() producto.titulo = context['form'].cleaned_data.get('titulo') producto.tipo = context['form'].cleaned_data.get('tipo') producto.descripcion = context['form'].cleaned_data.get('description') producto.referencia = context['form'].cleaned_data.get('referencia') producto.enlace = context['form'].cleaned_data.get('enlace') producto.save() return JsonResponse({'code':'200','id':str(producto.id),'titulo':producto.titulo,'cuerpo':''}) #return redirect('explorar','explorar') else: return JsonResponse({'code':'400','id':'','titulo':'','cuerpo':context['form'].errors}) # print(context['form'].errors) #print(dir(context['form'].is_valid())) context['form'] = FormularioProducto() return render(request, 'crear_producto.html', context)
def modificar_productos(request): context={} context['objetivo'] = 'Modificar' context['productos'] = Producto.objects.all() context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') return render(request, 'explorar_productos.html', context)
def producto_detalles(request, producto_id): context={} context['autorizacion'] = autorizaciones(request) context['producto'] = Producto.objects.get(id=producto_id) context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') return render(request, 'detalles_producto.html', context)
def investigaciones_detalles(request, investigaciones_id): context={} context['autorizacion'] = autorizaciones(request) context['investigaciones'] = Investigacion.objects.get(id=investigaciones_id) context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') return render(request, 'detalles_investigaciones.html', context)
def explorar_modificar_productos(request, objetivo): context={} context['autorizacion'] = autorizaciones(request) context['objetivo'] = objetivo context['productos'] = Producto.objects.all() context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') return render(request, 'explorar_productos.html', context)
def producto_detalles(request, producto_id): context={} print(">>>>>>>>>>>>>>>>>>producto_id") print(producto_id) context['producto'] = Producto.objects.get(id=producto_id) context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') return render(request, 'explorar_productos.html', context)
def index(request): context = {} context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') context['fullname'] = request.user.get_full_name() context['contenido'] = get_object_or_404(Pagina, titulo="Portada") if context['contenido'].texto: context['contenido'] = context['contenido'].texto return render(request, 'portada.html', context)
def index(request): context = {} context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') if request.user.is_authenticated(): context['contenido'] = "<H1> Bienvenido </H1>" context['fullname'] = request.user.get_full_name() else: context['contenido'] = get_object_or_404(Pagina, titulo="Portada") if context['contenido'].texto: context['contenido'] = context['contenido'].texto return render(request, 'portada.html', context)
def corpus_tabs(request,ID): context = {} context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') corpus = Corpora.objects.get(id=ID) context['titulo'] = corpus.nombre context['descripcion'] = corpus.descripcion context['audios'] = corpus.documentos context['sesiones'] = corpus.sesiones context['informantes'] = corpus.informantes print(corpus.sesiones) print('???????????????????????????????????????????????????????????????????') return render_to_response('ver_corpus.html', context)
def corpus_tabs(request, ID): context = {} context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') corpus = Corpora.objects.get(id=ID) context['titulo'] = corpus.nombre context['descripcion'] = corpus.descripcion context['audios'] = corpus.documentos context['sesiones'] = corpus.sesiones context['informantes'] = corpus.informantes print(corpus.sesiones) print( '???????????????????????????????????????????????????????????????????') return render_to_response('ver_corpus.html', context)
def crear_corpus(request): context={} context.update(csrf(request)) context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') if request.method == 'POST': context['form'] = UploadCSVFileForm(request.POST, request.FILES) if context['form'].is_valid(): corp = request.POST['nombre'] desc = request.POST['descripcion'] context['exito'] = handle_uploaded_file(request.FILES, corp, desc) return HttpResponseRedirect('/crearcorpus/') else: context['form'] = UploadCSVFileForm() return render_to_response('crear_corpus.html', context)
def crear_corpus(request): context = {} context.update(csrf(request)) context['NavBar'] = auth_menu(request, 'NavBar') context['SideBar1'] = auth_menu(request, 'SideBar1') if request.method == 'POST': context['form'] = UploadCSVFileForm(request.POST, request.FILES) if context['form'].is_valid(): corp = request.POST['nombre'] desc = request.POST['descripcion'] context['exito'] = handle_uploaded_file(request.FILES, corp, desc) return HttpResponseRedirect('/crearcorpus/') else: context['form'] = UploadCSVFileForm() return render_to_response('crear_corpus.html', context)
def ingreso(request): state = "Por favor ingrese su usuario y contraseña..." username = password = '' context = {} context['NavBar'] = auth_menu(request, 'NavBar') context.update(csrf(request)) next = "/" if request.GET: next = request.GET['next'] if request.POST: username = request.POST.get('username') password = request.POST.get('password') user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect(next) else: state = "Su cuenta no está activa, por favor contactese\ con el administrador." else: state = '<div style="color:red">\ <span class="glyphicon glyphicon-warning-sign"></span> \ Su usuario y/o su contraseña son incorrectos.</div>' context['state'] = state context['username'] = username context['next'] = next return render_to_response('ingreso.html', context)