Skip to content

Commit

Permalink
agregando lista de organizaciones
Browse files Browse the repository at this point in the history
  • Loading branch information
eos87 committed Dec 9, 2010
1 parent f804acf commit 82e275e
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 9 deletions.
2 changes: 2 additions & 0 deletions encuesta/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
urlpatterns = patterns('fed.encuesta.views',
(r'^influencia/$', 'influencia'),
(r'^indicadores/$', 'indicadores'),
(r'^lista/$', 'lista'),
(r'^lista/(?P<id>\d+)/$', 'lista'),
(r'^proyecto/(?P<id>\d+)/$', 'proyecto'),
(r'^indicadores/(?P<vista>[-\w]+)/$', '_get_view'),
)
Expand Down
34 changes: 34 additions & 0 deletions encuesta/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,40 @@ def index(request):
informes = Encuesta.objects.all().order_by('-id')[:5]
return render_to_response('index.html', RequestContext(request, locals()))

@login_required
def lista(request, id=None):
resultados = Resultado.objects.all()
dicc = {}
dicc2 = {}
org_list = []
depas = []
flag = False
if id != None:
selecto = int(id)
try:
r = resultados.get(pk=id)
flag = True
for rt in r.resultadotrabajado_set.all():
org_list.append(rt.encuesta.organizacion)

for org in org_list:
rts = ResultadoTrabajado.objects.filter(encuesta__organizacion=org, resultado=r)
for resultado in rts:
for m in resultado.municipio.all():
depas.append(m.departamento)
dicc[org] = list(set(depas))

departamentos = Departamento.objects.all()
for depa in departamentos:
orgs = []
rts = ResultadoTrabajado.objects.filter(municipio__in=depa.municipio_set.all(), resultado=r)
for rt in rts:
orgs.append(rt.encuesta.organizacion)
dicc2[depa] = list(set(orgs))
except:
pass
return render_to_response('fed/lista.html', RequestContext(request, locals()))

@login_required(redirect_field_name='next')
def influencia(request):
if request.is_ajax():
Expand Down
54 changes: 50 additions & 4 deletions files/css/fed.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ a:hover{
margin-right: 20px;
margin-top: 30px;
}
.ultimas .title{
.title{
font-size: 22px;
color: #646464;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ a:hover{
float: left;
width: 249px;
background: #555753 url(/files/images/bar_back.png) repeat-x;
text-align: center;
text-align: center;
}
.bar .title{
font-size: 21px;
Expand All @@ -289,6 +289,52 @@ a:hover{
margin-top: 10px;
margin-bottom: 10px;
}
.title_map{
font-size: 21px;
color: #d5d5d5;
text-shadow: 0 2px 3px #483916;
padding-top: 10px;
padding-bottom: 8px;
padding-right: 10px;
text-align: right;
background: #555753 url(/files/images/bar_back.png) repeat-x;
}
.title_map a{
color: #d5d5d5;
text-shadow: 0 2px 3px #483916;
}
.title_map2{
font-size: 14px;
color: #d5d5d5;
text-shadow: 0 2px 3px #483916;
padding-top: 10px;
padding-bottom: 8px;
padding-right: 3px;
padding-left: 10px;
text-align: center;
background: #555753 url(/files/images/title_back.png) repeat-x bottom;
}
.title_map2 a{
color: #d5d5d5;

text-shadow: 0 2px 3px #483916;
}
.list_elems{
float: left;
margin-left: 3px;
width: 138px;
}
.lista{
margin-left: 15px;
}
.separador{
font-size: 30px;
float: left;
margin-left: 3px;
}
a.actual{
color: #fe9c46;
}
.bar label.aux{
display: block;
width: 158px;
Expand Down Expand Up @@ -319,12 +365,12 @@ a:hover{
width: 709px;
}
.estilo2{
width: 420px;
width: 320px;
padding-left: 10px;
}
.resultados{
float: left;
margin-left: 20px;
margin-left: 80px;
margin-top: 15px;
}
.tiene{
Expand Down
Binary file added files/images/title_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os.path
# Django settings for achuapa project.
from settings_local import *

Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
#map_canvas { height: 500px; width: 710px; }
#map_canvas { height: 500px; width: 709px; }
</style>
<title>Sistema de Informacion FED | {% block extratitle %}{% endblock %}</title>
<link type="text/css" rel="stylesheet" href="/files/css/fed.css" >
Expand Down
2 changes: 1 addition & 1 deletion templates/fed/indicador232.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<thead>
<tr>
<th>Acciones</th>
<th>Comisariato</th>
<th>Comisar&iacute;a de la Mujer</th>
<th>Fiscal&iacute;a</th>
</tr>
</thead>
Expand Down
7 changes: 4 additions & 3 deletions templates/fed/influencia.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
return false;
});

var altura = $('.bar').height();
$('.mapa').height(altura);
$('#map_canvas').height(altura);
var altura = $('.bar').height();
/*$('.mapa').height(altura);*/
$('#map_canvas').height(altura-43);
var infowindow = new google.maps.InfoWindow();

var myLatlng = new google.maps.LatLng(13,-85);
Expand Down Expand Up @@ -137,6 +137,7 @@
</form>
</div>
<div class="mapa">
<div class="title_map"><a href="/lista/">Ver lista</a></div>
<div id="map_canvas">

</div>
Expand Down
58 changes: 58 additions & 0 deletions templates/fed/lista.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% extends "base.html" %}
{% block extratitle %} Ver lista {% endblock %}
{% block contenido %}
<div class="title_map2">
{% for r in resultados %}
<div class="list_elems">
<a href="/lista/{{r.pk}}" {% if selecto == r.pk %}class="actual"{% endif %}>{{r.nombre}}</a>
</div>
{% if forloop.last %}
{% else %}
<div class="separador">|</div>
{% endif %}
{% endfor %}
<div class="clean"></div>
</div>
<div>
{% if flag %}
<div>
<br>
<table class="mostrar">
<caption>POR ORGANIZACI&Oacute;N</caption>
<thead>
<tr>
<th>Organizaci&oacute;n</th>
<th>Departamentos</th>
</tr>
</thead>
{% for key, values in dicc.items %}
<tr>
<td>{{key}}</td>
<td>{% for v in values %}{{v}}{% if forloop.last %}{% else %},{% endif %} {% endfor %}</td>
</tr>
{%endfor%}
</table>
<br>
<table class="mostrar">
<caption>POR DEPARTAMENTO</caption>
<thead>
<tr>
<th>Departamento</th>
<th>Organizaciones</th>
</tr>
</thead>
{% for key, values in dicc2.items %}
<tr>
<td>{{key}}</td>
<td>{% for v in values %}{{v}}{% if forloop.last %}{% else %},{% endif %} {% endfor %}</td>
</tr>
{%endfor%}
</table>
</div>
{% else %}
<div style="margin-left: 20px;">
<h2>Debes seleccionar un resultado</h2>
</div>
{% endif %}
</div>
{% endblock %}

0 comments on commit 82e275e

Please sign in to comment.