Browse Source

Permitindo a visualização dos graficos

pesquisas
Breno Teixeira 11 years ago
parent
commit
cc199807ec
  1. 17
      sigi/apps/pesquisas/templates/admin/forms/entries.html
  2. 28
      sigi/apps/pesquisas/templates/pesquisas/chart.html
  3. 2
      sigi/apps/pesquisas/views.py
  4. 2
      sigi/urls.py

17
sigi/apps/pesquisas/templates/admin/forms/entries.html

@ -26,6 +26,7 @@ td.include, th.include-all, td.include-all {text-align:center; width:10px;}
.button {float:left !important; margin-right:10px; cursor:pointer;}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}admin/js/admin/RelatedObjectLookups.js"></script>
<script>
$(function() {
// Show the filter criteria fields when a filter option is selected.
@ -87,20 +88,24 @@ $(function() {
<tr>
<th>{% trans "Field" %}</th>
<th>{% trans "Include" %}</th>
<th class="last" colspan="2">{% trans "Filter by" %}</th>
<th colspan="2">{% trans "Filter by" %}</th>
<th class="last">{% trans "Graphic" %}</th>
</tr>
{% for include_field, filter_field, filter_option_fields in entries_form %}
{% for include_field, graphic_field, filter_field, filter_option_fields in entries_form %}
<tr class="{% cycle on,off as row %}">
<td class="field">{{ include_field.label_tag }}</td>
<td class="field">{{ include_field.label_tag }}<br>{{ include_field.id }}</td>
<td class="include">{{ include_field }}</td>
<td class="filter last">{{ filter_field }}</td>
<td class="options last">
<td class="filter">{{ filter_field }}</td>
<td class="options">
<div class="options-div">
{% for option_field in filter_option_fields %}
{{ option_field.label_tag }} {{ option_field }}
{% endfor %}
</div>
</td>
<td class="last">
<a href="{{ graphic_field.value }}" onclick="return showAddAnotherPopup(this);">{{ graphic_field.label }}</a>
</td>
</tr>
{% endfor %}
<tr class="{% cycle row %}">
@ -110,7 +115,7 @@ $(function() {
<td class="include-all">
<input type="checkbox" id="include-all" class="include-all" checked="checked">
</td>
<td class="last" colspan="2">&nbsp;</td>
<td class="last" colspan="3">&nbsp;</td>
</tr>
</table>
<input type="submit" name="back" class="button" value="{% trans "Back to form" %}">

28
sigi/apps/pesquisas/templates/pesquisas/chart.html

@ -0,0 +1,28 @@
<html xmlns="http://www.w3.org/1999/html">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script>
$(function () {
$('#chart').highcharts({
chart: {
type: 'pie'
},
title: {
text: 'Grafico'
},
series: [{
data: [
{% for serie in dados %}
['{{ serie.value }}', {{ serie.total }}],
{% endfor %}
]
}]
});
});
</script>
</head>
<body>
<div id="chart" style="width:100%; height:400px;"></div>
</body>
</html>

2
sigi/apps/pesquisas/views.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from sigi.forms_builder.forms.views import FormDetail, FormSent
from forms_builder.forms.views import FormDetail, FormSent
from sigi.apps.pesquisas.models import Pesquisa
from sigi.apps.pesquisas.forms import PesquisaForm

2
sigi/urls.py

@ -19,6 +19,8 @@ urlpatterns = patterns('',
url(r'^dashboard/', include('sigi.apps.metas.urls')),
url(r'^pesquisas/formulario/', include('sigi.apps.pesquisas.urls')),
url(r'^pesquisas/chart/(?P<field_id>\d+)/$', 'sigi.apps.pesquisas.views.chart_view'),
url(r'^', include(admin.site.urls)),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Loading…
Cancel
Save