Conjunto 59f3e60 en consulta_publica
- Fecha y hora:
- 20/07/2017 09:41:50 (hace 7 años)
- Branches:
- estudiantes, general, plan_patria, sala
- Children:
- 8f1d98d
- Parents:
- bcf369a
- Ficheros:
-
- 10 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
base/templates/inicio.html
r8edb1df r59f3e60 8 8 todo tipo de consultas, con módulos para la creación de consultas, visualización de consultas, 9 9 participación en consultas y análisis de información.</p> 10 <h3>¿Deseas participar en algun consulta?</h3>10 <h3>¿Deseas participar en alguna consulta?</h3> 11 11 <a type="button" href="{% url 'participacion_index' %}" class="btn btn-warning btn-lg">Participar</a><br><br> 12 12 <p>Ãste es el sitio indicado para iniciar.</p><br> -
consulta/forms.py
r8edb1df r59f3e60 115 115 self.fields['municipio'].choices = cargar_municipios() 116 116 self.fields['parroquia'].choices = cargar_parroquias() 117 self.fields['tipo_pregunta'].choices = cargar_preguntas( 1)117 self.fields['tipo_pregunta'].choices = cargar_preguntas(3) 118 118 119 119 ## Tipo de pregunta para generar el reporte … … 125 125 widget=forms.Select(attrs={'class':'form-control'}), 126 126 label="Objetivo de la Asamblea Nacional Constituyente", 127 choices = (('','Seleccione...'),)+OBJETIVOS 127 choices = (('','Seleccione...'),)+OBJETIVOS, required = False 128 128 ) 129 129 -
consulta/templates/consulta.detail.html
r8edb1df r59f3e60 31 31 <a type="button" class="btn btn-white" href="{% url 'consulta_report' consulta.id %}"> Generar Reportes <i class="glyphicon glyphicon-list-alt"></i></a> 32 32 {% endif %} 33 {% if respuestas_abierta %} 33 {% if respuestas_abierta and not respuestas %} 34 <a type="button" class="btn btn-white" href="{% url 'consulta_stats' consulta.id %}"> EstadÃsticas <i class="glyphicon glyphicon-stats"></i></a> 34 35 <a type="button" class="btn btn-white" href="#" onclick="create_files();"> Generar Texto de Respuestas <i class="glyphicon glyphicon-file"></i></a> 35 36 {% endif%} -
consulta/templates/consulta.pdf.template.html
rbe17cf0 r59f3e60 31 31 <div> 32 32 <p><b>Pregunta: </b>{{pregunta_texto}}<p> 33 <p><b>Objetivo: </b>{{objetivo_texto}}<p> 33 {% if objetivo_texto %} 34 <p><b>Objetivo: </b>{{objetivo_texto}}<p> 35 {% endif %} 34 36 </div> 35 37 {% if lugar > 0 %} … … 37 39 {% endif %} 38 40 {% if estados %} 39 {% include 'consulta.base.multi.table.pdf.html' with title_1='Ubicación' title_2='Participantes' texto=sector_trabajador_texto valor=sector_trabajador data=estados caption='Participación por todos los estados' %} 41 {% include 'consulta.base.multi.table.pdf.html' with title_1='Ubicación' title_2='Participantes' data=estados caption='Participación por todos los estados' %} 42 {% endif %} 43 {% if municipios %} 44 {% include 'consulta.base.multi.table.pdf.html' with title_1='Municipios' title_2='Participantes' data=municipios caption='Participación por todos los municipios' %} 45 {% endif %} 46 {% if parroquias %} 47 {% include 'consulta.base.multi.table.pdf.html' with title_1='Parroquias' title_2='Participantes' data=parroquias caption='Participación por todos los municipios' %} 40 48 {% endif %} 41 49 {% if sector >= 0 %} -
consulta/templates/consulta.stats.html
r8edb1df r59f3e60 13 13 {% include 'consulta.base.pie.graphic.html' with item=item counter=forloop.counter name='usuarios'%} 14 14 {% endfor %} 15 16 <a type="button" class="btn btn-white" href="{% url 'consulta_detail' pk %}">Regresar</a> 15 17 16 18 {% endblock %} -
consulta/urls.py
r8edb1df r59f3e60 25 25 url(r'^stats/(?P<pk>\d+)$', ConsultaStats.as_view(), name = "consulta_stats"), 26 26 url(r'^report/(?P<pk>\d+)$', ConsultaReport.as_view(), name = "consulta_report"), 27 url(r'^pdf/(?P<pk>\d+)/(?P<tipo_pregunta>\d+) /(?P<objetivo>\d+)$', ConsultaPdf.as_view(), name = "consulta_pdf"),27 url(r'^pdf/(?P<pk>\d+)/(?P<tipo_pregunta>\d+)$', ConsultaPdf.as_view(), name = "consulta_pdf"), 28 28 url(r'^delete/(?P<pk>\d+)$', ConsultaDelete.as_view(), name = "consulta_delete"), 29 29 url(r'^detail/(?P<pk>\d+)$', ConsultaDetail.as_view(), name = "consulta_detail"), -
consulta/views.py
rbe17cf0 r59f3e60 261 261 opciones = [] 262 262 valores = [] 263 for item in OBJETIVOS: 264 respuesta = RespuestaAbierta.objects.filter(pregunta__consulta_id=self.kwargs['pk'],objetivo=item[0]).count() 265 opciones.append(item[1].encode('utf8')) 266 valores.append(respuesta) 263 kwargs['participacion'] = [] 264 if RespuestaAbierta.objects.filter(pregunta__consulta_id=self.kwargs['pk']): 265 for item in OBJETIVOS: 266 respuesta = RespuestaAbierta.objects.filter(pregunta__consulta_id=self.kwargs['pk'],objetivo=item[0]).count() 267 opciones.append(item[1].encode('utf8')) 268 valores.append(respuesta) 269 kwargs['participacion'].append({'titulo':'Respuestas por Objetivo de la Constituyente','opciones':json.dumps(opciones),'valores':valores}) 270 if RespuestaOpciones.objects.filter(opcion__pregunta__consulta_id=self.kwargs['pk']): 271 kwargs['participacion'].append(self.get_pregunta_sino(self.kwargs['pk'])) 272 if RespuestaSino.objects.filter(pregunta__consulta_id=self.kwargs['pk']): 273 kwargs['participacion'].append(self.get_pregunta_opciones(self.kwargs['pk'])) 274 267 275 kwargs['usuarios'] = [self.get_users()] 268 kwargs['participacion'] = [{'titulo':'Respuestas por Objetivo de la Constituyente','opciones':json.dumps(opciones),'valores':valores}]269 276 return super(ConsultaStats, self).get_context_data(**kwargs) 270 277 … … 288 295 289 296 290 def get_pregunta_opciones(self,id,titulo ):297 def get_pregunta_opciones(self,id,titulo=''): 291 298 """! 292 299 Metodo que permite cargar las opciones para una pregunta simple o múltiple … … 301 308 options = [] 302 309 values = [] 303 for opcion in Opcion.objects.filter(pregunta_ id=id).all():310 for opcion in Opcion.objects.filter(pregunta__consulta_id=id).all(): 304 311 options.append(opcion.texto_opcion.encode('utf8')) 305 312 values.append(RespuestaOpciones.objects.filter(opcion_id=opcion.id).count()) 313 if titulo=='': 314 opc = Opcion.objects.filter(pregunta__consulta_id=id).first() 315 titulo = opc.pregunta.texto_pregunta 306 316 data = {} 307 317 data['titulo'] = titulo … … 310 320 return data 311 321 312 def get_pregunta_sino(self,id,titulo ):322 def get_pregunta_sino(self,id,titulo=''): 313 323 """! 314 324 Metodo que permite cargar las opciones para una pregunta si o no … … 321 331 @return Retorna los datos de contexto 322 332 """ 323 Si = RespuestaSino.objects.filter(respuesta=True).count() 324 No = RespuestaSino.objects.filter(respuesta=False).count() 333 if titulo=='': 334 opc = RespuestaSino.objects.filter(pregunta__consulta_id=id).first() 335 titulo = opc.pregunta.texto_pregunta 336 Si = RespuestaSino.objects.filter(respuesta=True,pregunta__consulta_id=id).count() 337 No = RespuestaSino.objects.filter(respuesta=False,pregunta__consulta_id=id).count() 325 338 data = {} 326 339 data['titulo'] = titulo … … 353 366 """ 354 367 tipo_pregunta = self.request.POST['tipo_pregunta'] 355 objetivo = self.request.POST['objetivo'] 368 objetivo = self.request.POST.get('objetivo','') 369 print objetivo 356 370 estado = self.request.POST.get('estado','') 357 371 municipio = self.request.POST.get('municipio','') … … 360 374 sector_trabajador = self.request.POST.get('sector_trabajador','') 361 375 sector_estudiante = self.request.POST.get('sector_estudiante','') 362 url = '%s? estado=%s&municipio=%s&parroquia=%s§or=%s§or_trabajador=%s§or_estudiante=%s' % (reverse_lazy('consulta_pdf',363 kwargs={'pk': self.kwargs['pk'],'tipo_pregunta': tipo_pregunta ,'objetivo': objetivo}),364 estado,municipio,parroquia,sector,sector_trabajador,sector_estudiante)376 url = '%s?objetivo=%s&estado=%s&municipio=%s&parroquia=%s§or=%s§or_trabajador=%s§or_estudiante=%s' % (reverse_lazy('consulta_pdf', 377 kwargs={'pk': self.kwargs['pk'],'tipo_pregunta': tipo_pregunta}), 378 objetivo,estado,municipio,parroquia,sector,sector_trabajador,sector_estudiante) 365 379 return url 366 380 … … 403 417 pk = int(self.kwargs['pk']) 404 418 tipo_pregunta = int(self.kwargs['tipo_pregunta']) 405 objetivo = int(self.kwargs['objetivo'])406 419 ## Variables por get 420 objetivo = self.request.GET['objetivo'] 407 421 estado = self.request.GET['estado'] 408 422 municipio = self.request.GET['municipio'] … … 413 427 resp = 0 414 428 est, mun, parr = 0, 0, 0 415 preg = Pregunta.objects.get(pk=pk).texto_pregunta 416 if tipo_pregunta == 1: 417 resp = RespuestaSino.objects.filter(pregunta__consulta_id=pk,objetivo=objetivo) 418 elif tipo_pregunta == 2: 429 preg = Pregunta.objects.get(pk=tipo_pregunta) 430 if preg.tipo_pregunta_id >=1 and preg.tipo_pregunta_id <3: 431 resp = RespuestaSino.objects.filter(pregunta__consulta_id=pk) 432 elif preg.tipo_pregunta_id >2 and preg.tipo_pregunta_id <5: 433 resp = RespuestaOpciones.objects.filter(opcion__pregunta__consulta_id=pk) 434 elif preg.tipo_pregunta_id == 5: 419 435 resp = RespuestaAbierta.objects.filter(pregunta__consulta_id=pk,objetivo=objetivo) 420 elif tipo_pregunta == 3:421 resp = RespuestaOpciones.objects.filter(opcion__pregunta__consulta_id=pk,objetivo=objetivo)422 436 ## Se validan los filtros por territorio 423 437 if estado == '': … … 431 445 kwargs['lugar'] = est.count() 432 446 kwargs['ubicacion'] = Entidad.objects.get(pk=estado) 447 ## Muestra los datos por los municipios del estado 448 datos = [] 449 for municipio in Municipio.objects.filter(entidad_id=estado).all(): 450 data = Perfil.objects.filter(parroquia__municipio_id=municipio.id,user_id__in=resp.values_list('user_id',flat=True)).count() 451 datos.append([municipio.nombre,data]) 452 kwargs['municipios'] = datos 433 453 elif municipio!='' and parroquia=='': 434 454 mun = Perfil.objects.filter(parroquia__municipio_id=municipio,user_id__in=resp.values_list('user_id',flat=True)) 435 455 kwargs['lugar'] = mun.count() 436 kwargs['ubicacion'] = Municipio.objects.filter(pk=municipio) 456 kwargs['ubicacion'] = Municipio.objects.get(pk=municipio) 457 ## Muestra los datos por la parroquia 458 datos = [] 459 for parroquia in Parroquia.objects.filter(municipio_id=municipio).all(): 460 data = Perfil.objects.filter(parroquia_id=parroquia.id,user_id__in=resp.values_list('user_id',flat=True)).count() 461 datos.append([parroquia.nombre,data]) 462 kwargs['parroquias'] = datos 437 463 elif parroquia!='': 438 464 parr = Perfil.objects.filter(parroquia_id=parroquia,user_id__in=resp.values_list('user_id',flat=True)) … … 468 494 kwargs['sector_texto'] = SECTOR[sector] 469 495 kwargs['respuestas'] = resp.count() 470 kwargs['pregunta_texto'] = preg 471 kwargs['objetivo_texto'] = OBJETIVOS[ objetivo-1][1]496 kwargs['pregunta_texto'] = preg.texto_pregunta 497 kwargs['objetivo_texto'] = OBJETIVOS[int(objetivo)-1][1] if objetivo else None 472 498 return super(ConsultaPdf, self).get_context_data(**kwargs) 473 499 -
participacion/templates/participacion.create.simple.html
rbcf369a r59f3e60 5 5 <h1 class="text-center">Encuesta de la constituyente</h1><hr> 6 6 <h4 class="text-justify"> 7 Un sistema sencillo y soberano desarrollado bajo la premisa de tecnologÃas libres y trabajo colaborativo para ampliar la participación protagónica 8 en la convocatoria a la Asamblea Nacional Constituyente. 9 7 Un sistema sencillo y soberano, desarrollado bajo la premisa de tecnologÃas libres y trabajo colaborativo, 8 para ampliar la participación protagónica en la convocatoria a la Asamblea Nacional Constituyente. 10 9 A continuación encontrará 3 preguntas sencillas que le permitirán expresar su opinión sobre la Constituyente. 11 10 </h4> -
participacion/templates/participacion.index.html
ra401f70 r59f3e60 8 8 <div class="row text-center"> 9 9 <h1>Ver Consultas</h1><hr> 10 <p>A continuación participe en la Encuesta Constituyente para expresar su opinión en torno a la convocatoria a la ANC y 11 Realice aportes a la discusión de la Constituyente según los objetivos de su interés. 12 Podrá participar una (1) vez en la Encuesta Constituyente y realizar un (1) aporte para cada objetivo de la ANC.</p> 10 13 <div class="col-md-12 col-sm-12 col-xs-12"> 11 14 <div class="form-group {% if form.consultas.errors %}has-error{% endif %}"> … … 21 24 </div> 22 25 <div class="col-md-12 col-sm-12 col-xs-12"> 23 <button type="submit" class="btn btn-red btn-large">B úscar</button>26 <button type="submit" class="btn btn-red btn-large">Buscar</button> 24 27 </div> 25 28 </div> -
participacion/views.py
rbcf369a r59f3e60 121 121 elif pregunta.tipo_pregunta.id > 2 and pregunta.tipo_pregunta.id < 5: 122 122 if(pregunta.tipo_pregunta.id == 3): 123 campo += '<label for="'+kwargs['pk']+'">S i</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="Si" class="icheck">'123 campo += '<label for="'+kwargs['pk']+'">SÃ</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="Si" class="icheck">' 124 124 campo += '<label for="'+kwargs['pk']+'">No</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="No" class="icheck">' 125 125 else: 126 campo += '<label for="'+kwargs['pk']+'">S i</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="Si" class="icheck need_justification">'126 campo += '<label for="'+kwargs['pk']+'">SÃ</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="Si" class="icheck need_justification">' 127 127 campo += '<label for="'+kwargs['pk']+'">No</label><input type="radio" name="consulta_respuesta_sino_'+str(pregunta.id)+'" id="'+kwargs['pk']+'"value="No" class="icheck">' 128 128 campo += '<div id="div_justificar_'+kwargs['pk']+'" style="display:none;"><label>Indique con que instrumento legal en vigencia se relaciona su aporte</label>'
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.