Browse Source

Atualiza para Django 1.9.6

pull/6/head
Sesostris Vieira 9 years ago
committed by Luciano Almeida
parent
commit
e3b3727804
  1. 8
      requirements/dev-requirements.txt
  2. 26
      requirements/requirements.txt
  3. 16
      requirements/test-requirements.txt
  4. 4
      sigi/apps/casas/admin.py
  5. 8
      sigi/apps/casas/models.py
  6. 10
      sigi/apps/contatos/models.py
  7. 8
      sigi/apps/convenios/models.py
  8. 2
      sigi/apps/diagnosticos/forms.py
  9. 4
      sigi/apps/diagnosticos/models.py
  10. 2
      sigi/apps/diagnosticos/templates/diagnosticos/mapa.html
  11. 6
      sigi/apps/diagnosticos/widgets.py
  12. 6
      sigi/apps/inventario/admin.py
  13. 6
      sigi/apps/inventario/models.py
  14. 2
      sigi/apps/metas/templates/metas/mapa.html
  15. 12
      sigi/apps/metas/views.py
  16. 2
      sigi/apps/ocorrencias/forms.py
  17. 2
      sigi/apps/ocorrencias/models.py
  18. 2
      sigi/apps/ocorrencias/templates/ocorrencias/painel.html
  19. 4
      sigi/apps/parlamentares/admin.py
  20. 4
      sigi/apps/servicos/admin.py
  21. 2
      sigi/apps/servicos/models.py
  22. 2
      sigi/apps/servicos/templates/servicos/mapa.html
  23. 2
      sigi/apps/servidores/admin.py
  24. 6
      sigi/apps/servidores/models.py
  25. 4
      sigi/settings/base.py
  26. 2
      templates/index.html

8
requirements/dev-requirements.txt

@ -1,5 +1,5 @@
-r test-requirements.txt -r test-requirements.txt
django-debug-toolbar==1.2.2 django-debug-toolbar==1.4
ipdb==0.8 ipdb==0.10.0
ipython==2.3.1 ipython==4.2.0
pygraphviz==1.2 pygraphviz==1.3.1

26
requirements/requirements.txt

@ -1,23 +1,23 @@
-e git://github.com/marinho/geraldo.git@868ebdce67176d9b6205cddc92476f642c783fff#egg=geraldo -e git://github.com/marinho/geraldo.git@868ebdce67176d9b6205cddc92476f642c783fff#egg=geraldo
django-bootstrap3==6.2.2 django-bootstrap3==7.0.1
django-admin-bootstrapped==2.4.0 django-admin-bootstrapped==2.5.7
django-auth-ldap==1.2.7 django-auth-ldap==1.2.8
django-autoslug==1.9.3 django-autoslug==1.9.3
django-extensions==1.5.7 django-extensions==1.6.7
django-image-cropping==1.0.2 django-image-cropping==1.0.3
django-localflavor==1.1 django-localflavor==1.3
Django==1.7.10 Django==1.9.6
easy-thumbnails==2.2 easy-thumbnails==2.3
eav-django==1.4.7 eav-django==1.4.7
gunicorn==19.3.0 gunicorn==19.6.0
html5lib==0.9999999 html5lib==0.9999999
Pillow==2.9.0 Pillow==3.2.0
pisa==3.0.33 pisa==3.0.33
psycopg2==2.6.1 psycopg2==2.6.1
python-memcached==1.53 python-memcached==1.58
PyYAML==3.11 PyYAML==3.11
reportlab==2.7 reportlab==3.3.0
requests==2.8.1 requests==2.10.0
six==1.10.0 six==1.10.0
djangorestframework==2.4.8 djangorestframework==2.4.8
django-ipware==1.1.6 django-ipware==1.1.6

16
requirements/test-requirements.txt

@ -1,10 +1,10 @@
-r requirements.txt -r requirements.txt
coverage==3.7.1 coverage==4.1
django-dynamic-fixture==1.8.1 django-dynamic-fixture==1.9.0
django-webtest==1.7.7 django-webtest==1.7.9
pyPdf==1.13 pyPdf==1.13
pyquery==1.2.9 pyquery==1.2.13
pytest-cov==1.8.1 pytest-cov==2.2.1
pytest-django==2.8.0 pytest-django==2.9.1
pytest==2.6.4 pytest==2.9.2
WebTest==2.0.17 WebTest==2.0.21

4
sigi/apps/casas/admin.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes import generic from django.contrib.contenttypes.admin import GenericTabularInline
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from image_cropping import ImageCroppingMixin from image_cropping import ImageCroppingMixin
@ -24,7 +24,7 @@ from sigi.apps.utils import queryset_ascii
from sigi.apps.utils.base_admin import BaseModelAdmin from sigi.apps.utils.base_admin import BaseModelAdmin
class TelefonesInline(generic.GenericTabularInline): class TelefonesInline(GenericTabularInline):
model = Telefone model = Telefone
readonly_fields = ('ult_alteracao',) readonly_fields = ('ult_alteracao',)
extra = 1 extra = 1

8
sigi/apps/casas/models.py

@ -4,7 +4,7 @@ from string import ascii_uppercase
from unicodedata import normalize from unicodedata import normalize
from datetime import datetime from datetime import datetime
from django.contrib.contenttypes import generic from django.contrib.contenttypes import fields
from django.db import models from django.db import models
from image_cropping import ImageRatioField from image_cropping import ImageRatioField
@ -85,7 +85,7 @@ class CasaLegislativa(models.Model):
pesquisador = models.ForeignKey(Servidor, verbose_name=u"Pesquisador", null=True, blank=True) pesquisador = models.ForeignKey(Servidor, verbose_name=u"Pesquisador", null=True, blank=True)
obs_pesquisa = models.TextField(u"Observações do pesquisador", blank=True) obs_pesquisa = models.TextField(u"Observações do pesquisador", blank=True)
ult_alt_endereco = models.DateTimeField(u'Última alteração do endereço', null=True, blank=True, editable=True) ult_alt_endereco = models.DateTimeField(u'Última alteração do endereço', null=True, blank=True, editable=True)
telefones = generic.GenericRelation('contatos.Telefone') telefones = fields.GenericRelation('contatos.Telefone')
foto = models.ImageField( foto = models.ImageField(
upload_to='imagens/casas', upload_to='imagens/casas',
@ -293,8 +293,8 @@ class Funcionario(models.Model):
sexo = models.CharField(max_length=1, choices=SEXO_CHOICES, default="M") sexo = models.CharField(max_length=1, choices=SEXO_CHOICES, default="M")
nota = models.CharField(max_length=70, null=True, blank=True) nota = models.CharField(max_length=70, null=True, blank=True)
email = models.CharField('e-mail', max_length=75, blank=True) email = models.CharField('e-mail', max_length=75, blank=True)
telefones = generic.GenericRelation('contatos.Telefone') telefones = fields.GenericRelation('contatos.Telefone')
endereco = generic.GenericRelation('contatos.Endereco') endereco = fields.GenericRelation('contatos.Endereco')
cargo = models.CharField(max_length=100, null=True, blank=True) cargo = models.CharField(max_length=100, null=True, blank=True)
funcao = models.CharField(u'função', max_length=100, null=True, blank=True) funcao = models.CharField(u'função', max_length=100, null=True, blank=True)
setor = models.CharField(max_length=100, choices=SETOR_CHOICES, default="outros") setor = models.CharField(max_length=100, choices=SETOR_CHOICES, default="outros")

10
sigi/apps/contatos/models.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib.contenttypes import generic from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.validators import MaxValueValidator, MinValueValidator from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models from django.db import models
@ -176,7 +176,7 @@ class Telefone(models.Model):
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
# identificador do registro na classe vinculado a esse registro # identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = fields.GenericForeignKey('content_type', 'object_id')
class Meta: class Meta:
ordering = ('numero',) ordering = ('numero',)
@ -196,7 +196,7 @@ class Contato(models.Model):
nota = models.CharField(max_length=70, blank=True) nota = models.CharField(max_length=70, blank=True)
email = models.EmailField(_(u'e-mail'), blank=True) email = models.EmailField(_(u'e-mail'), blank=True)
telefones = generic.GenericRelation(Telefone) telefones = fields.GenericRelation(Telefone)
municipio = models.ForeignKey( municipio = models.ForeignKey(
Municipio, Municipio,
@ -209,7 +209,7 @@ class Contato(models.Model):
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
# identificador do registro na classe vinculado a esse registro # identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = fields.GenericForeignKey('content_type', 'object_id')
class Meta: class Meta:
ordering = ('nome',) ordering = ('nome',)
@ -301,7 +301,7 @@ class Endereco(models.Model):
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
# identificador do registro na classe vinculado a esse registro # identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = fields.GenericForeignKey('content_type', 'object_id')
class Meta: class Meta:
ordering = ('logradouro', 'numero') ordering = ('logradouro', 'numero')

8
sigi/apps/convenios/models.py

@ -148,7 +148,7 @@ class Anexo(models.Model):
convenio = models.ForeignKey(Convenio, verbose_name=_(u'convênio')) convenio = models.ForeignKey(Convenio, verbose_name=_(u'convênio'))
# caminho no sistema para o documento anexo # caminho no sistema para o documento anexo
arquivo = models.FileField(upload_to='apps/convenios/anexo/arquivo', max_length=500) arquivo = models.FileField(upload_to='apps/convenios/anexo/arquivo', max_length=500)
descricao = models.CharField(_(u'descrição'), max_length='70') descricao = models.CharField(_(u'descrição'), max_length=70)
data_pub = models.DateTimeField( data_pub = models.DateTimeField(
_(u'data da publicação do anexo'), _(u'data da publicação do anexo'),
default=datetime.now default=datetime.now
@ -167,8 +167,8 @@ class UnidadeAdministrativa(models.Model):
que pode ser um servivo do próprio Interlegis, assim como que pode ser um servivo do próprio Interlegis, assim como
uma unidade do Senado Federal uma unidade do Senado Federal
""" """
sigla = models.CharField(max_length='10') sigla = models.CharField(max_length=10)
nome = models.CharField(max_length='100') nome = models.CharField(max_length=100)
def __unicode__(self): def __unicode__(self):
return unicode(self.sigla) return unicode(self.sigla)
@ -184,7 +184,7 @@ class Tramitacao(models.Model):
data = models.DateField() data = models.DateField()
observacao = models.CharField( observacao = models.CharField(
_(u'observação'), _(u'observação'),
max_length='512', max_length=512,
null=True, null=True,
blank=True, blank=True,
) )

2
sigi/apps/diagnosticos/forms.py

@ -2,7 +2,7 @@
from copy import deepcopy from copy import deepcopy
from django import forms from django import forms
from django.contrib.contenttypes.generic import generic_inlineformset_factory from django.contrib.contenttypes.forms import generic_inlineformset_factory
from django.forms import (BooleanField, CharField, DateField, from django.forms import (BooleanField, CharField, DateField,
FloatField, ModelChoiceField, Textarea, FloatField, ModelChoiceField, Textarea,
ModelMultipleChoiceField) ModelMultipleChoiceField)

4
sigi/apps/diagnosticos/models.py

@ -198,7 +198,7 @@ class Escolha(BaseChoice):
""" """
schema = models.ForeignKey(Pergunta, schema = models.ForeignKey(Pergunta,
related_name='choices', verbose_name=_(u'pergunta')) related_name='choices', verbose_name=_(u'pergunta'))
schema_to_open = models.ForeignKey(Pergunta, related_name='', schema_to_open = models.ForeignKey(Pergunta, related_name='schema_to_open_related',
verbose_name=_(u'pergunta para abrir'), blank=True, null=True) verbose_name=_(u'pergunta para abrir'), blank=True, null=True)
ordem = models.PositiveIntegerField(blank=True, null=True) ordem = models.PositiveIntegerField(blank=True, null=True)
@ -242,7 +242,7 @@ class Anexo(models.Model):
""" """
diagnostico = models.ForeignKey(Diagnostico, verbose_name=u'diagnóstico') diagnostico = models.ForeignKey(Diagnostico, verbose_name=u'diagnóstico')
arquivo = models.FileField(upload_to='apps/diagnostico/anexo/arquivo', max_length=500) arquivo = models.FileField(upload_to='apps/diagnostico/anexo/arquivo', max_length=500)
descricao = models.CharField(_(u'descrição'), max_length='70') descricao = models.CharField(_(u'descrição'), max_length=70)
data_pub = models.DateTimeField(_(u'data da publicação do anexo'), data_pub = models.DateTimeField(_(u'data da publicação do anexo'),
default=datetime.now) default=datetime.now)

2
sigi/apps/diagnosticos/templates/diagnosticos/mapa.html

@ -6,7 +6,7 @@
{{ block.super }} {{ block.super }}
{% load static from staticfiles %} {% load static from staticfiles %}
<script type="text/javascript" src="{% static "admin/js/core.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/core.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery-1.9.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript"> <script type="text/javascript">

6
sigi/apps/diagnosticos/widgets.py

@ -1,5 +1,5 @@
from itertools import chain from itertools import chain
from django.forms.widgets import CheckboxInput, CheckboxSelectMultiple, RadioSelect, RadioFieldRenderer, RadioInput from django.forms.widgets import CheckboxInput, CheckboxSelectMultiple, RadioSelect, RadioFieldRenderer, RadioChoiceInput
from django.utils.html import conditional_escape from django.utils.html import conditional_escape
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
@ -46,7 +46,7 @@ class EavRadioFieldRenderer(RadioFieldRenderer):
if schema_to_open: if schema_to_open:
final_attrs['schema_to_open'] = schema_to_open.name final_attrs['schema_to_open'] = schema_to_open.name
yield RadioInput(self.name, self.value, final_attrs, choice, i) yield RadioChoiceInput(self.name, self.value, final_attrs, choice, i)
def __getitem__(self, idx): def __getitem__(self, idx):
choice = self.choices[idx] choice = self.choices[idx]
@ -59,7 +59,7 @@ class EavRadioFieldRenderer(RadioFieldRenderer):
if schema_to_open: if schema_to_open:
final_attrs['schema_to_open'] = schema_to_open.name final_attrs['schema_to_open'] = schema_to_open.name
return RadioInput(self.name, self.value, final_attrs, choice, idx) return RadioChoiceInput(self.name, self.value, final_attrs, choice, idx)
class EavRadioSelect(RadioSelect): class EavRadioSelect(RadioSelect):

6
sigi/apps/inventario/admin.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes import generic from django.contrib.contenttypes.admin import GenericTabularInline
from sigi.apps.contatos.models import Contato, Telefone from sigi.apps.contatos.models import Contato, Telefone
from sigi.apps.inventario.models import (Fornecedor, Fabricante, Equipamento, from sigi.apps.inventario.models import (Fornecedor, Fabricante, Equipamento,
@ -9,13 +9,13 @@ from sigi.apps.inventario.models import (Fornecedor, Fabricante, Equipamento,
from sigi.apps.utils.base_admin import BaseModelAdmin from sigi.apps.utils.base_admin import BaseModelAdmin
class ContatosInline(generic.GenericTabularInline): class ContatosInline(GenericTabularInline):
model = Contato model = Contato
extra = 2 extra = 2
raw_id_fields = ('municipio',) raw_id_fields = ('municipio',)
class TelefonesInline(generic.GenericTabularInline): class TelefonesInline(GenericTabularInline):
model = Telefone model = Telefone
extra = 2 extra = 2

6
sigi/apps/inventario/models.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib.contenttypes import generic from django.contrib.contenttypes import fields
from django.db import models from django.db import models
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -9,8 +9,8 @@ class Fornecedor(models.Model):
nome.alphabetic_filter = True nome.alphabetic_filter = True
email = models.EmailField(_(u'e-mail'), blank=True) email = models.EmailField(_(u'e-mail'), blank=True)
pagina_web = models.URLField(_(u'página web'), blank=True) pagina_web = models.URLField(_(u'página web'), blank=True)
telefones = generic.GenericRelation('contatos.Telefone') telefones = fields.GenericRelation('contatos.Telefone')
contatos = generic.GenericRelation('contatos.Contato') contatos = fields.GenericRelation('contatos.Contato')
class Meta: class Meta:
ordering = ('nome',) ordering = ('nome',)

2
sigi/apps/metas/templates/metas/mapa.html

@ -8,7 +8,7 @@
{{ block.super }} {{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
<script type="text/javascript" src="{% static "admin/js/core.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/core.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery-1.9.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="{% static 'metas/js/mapa.js' %}" ></script> <script type="text/javascript" src="{% static 'metas/js/mapa.js' %}" ></script>

12
sigi/apps/metas/views.py

@ -12,7 +12,7 @@ from django.db.models.aggregates import Sum
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, render_to_response from django.shortcuts import render, render_to_response
from django.template import RequestContext from django.template import RequestContext
from django.utils.datastructures import SortedDict from collections import OrderedDict
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
from easy_thumbnails.templatetags.thumbnail import thumbnail_url from easy_thumbnails.templatetags.thumbnail import thumbnail_url
@ -36,8 +36,8 @@ def dashboard(request):
raise PermissionDenied raise PermissionDenied
desembolsos_max = 0 desembolsos_max = 0
matriz = SortedDict() matriz = OrderedDict()
dados = SortedDict() dados = OrderedDict()
projetos = Projeto.objects.all() projetos = Projeto.objects.all()
meses = Desembolso.objects.dates('data', 'month', 'DESC')[:6] meses = Desembolso.objects.dates('data', 'month', 'DESC')[:6]
colors = ['ffff00', 'cc7900', 'ff0000', '92d050', '006600', '0097cc', '002776', 'ae78d6', 'ff00ff', '430080', colors = ['ffff00', 'cc7900', 'ff0000', '92d050', '006600', '0097cc', '002776', 'ae78d6', 'ff00ff', '430080',
@ -137,9 +137,9 @@ def map_sum(request):
casas = filtrar_casas(**param) casas = filtrar_casas(**param)
# Montar registros de totalização # Montar registros de totalização
tot_servicos = SortedDict() tot_servicos = OrderedDict()
tot_projetos = SortedDict() tot_projetos = OrderedDict()
tot_diagnosticos = SortedDict() tot_diagnosticos = OrderedDict()
for ts in TipoServico.objects.all(): for ts in TipoServico.objects.all():
tot_servicos[ts.sigla] = 0 tot_servicos[ts.sigla] = 0

2
sigi/apps/ocorrencias/forms.py

@ -68,7 +68,7 @@ class AnexoForm(ModelForm):
widgets = {'ocorrencia': HiddenInput()} widgets = {'ocorrencia': HiddenInput()}
class ComentarioForm(ModelForm): class ComentarioForm(ModelForm):
encaminhar_setor = ModelChoiceField(queryset=Servico.objects.all(), cache_choices=True) encaminhar_setor = ModelChoiceField(queryset=Servico.objects.all())
class Meta: class Meta:
model = Comentario model = Comentario

2
sigi/apps/ocorrencias/models.py

@ -105,7 +105,7 @@ class Comentario(models.Model):
class Anexo(models.Model): class Anexo(models.Model):
ocorrencia = models.ForeignKey(Ocorrencia, verbose_name=_(u'ocorrência')) ocorrencia = models.ForeignKey(Ocorrencia, verbose_name=_(u'ocorrência'))
arquivo = models.FileField(_(u'Arquivo anexado'), upload_to='apps/ocorrencia/anexo/arquivo', max_length=500) arquivo = models.FileField(_(u'Arquivo anexado'), upload_to='apps/ocorrencia/anexo/arquivo', max_length=500)
descricao = models.CharField(_(u'descrição do anexo'), max_length='70') descricao = models.CharField(_(u'descrição do anexo'), max_length=70)
data_pub = models.DateTimeField(_(u'data da publicação do anexo'), null=True, blank=True, auto_now_add=True) data_pub = models.DateTimeField(_(u'data da publicação do anexo'), null=True, blank=True, auto_now_add=True)
class Meta: class Meta:

2
sigi/apps/ocorrencias/templates/ocorrencias/painel.html

@ -11,7 +11,7 @@
{% block extrahead %} {% block extrahead %}
{{ block.super }} {{ block.super }}
<script type="text/javascript" src="{% static 'admin/js/core.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/core.js' %}" ></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.min.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/jquery-1.9.1.min.js' %}" ></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script>
<script type="text/javascript" src="{% static 'ocorrencias/js/jquery-ui.min.js' %}" ></script> <script type="text/javascript" src="{% static 'ocorrencias/js/jquery-ui.min.js' %}" ></script>
{% endblock %} {% endblock %}

4
sigi/apps/parlamentares/admin.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes import generic from django.contrib.contenttypes.admin import GenericTabularInline
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse
from django.utils.html import escape, escapejs from django.utils.html import escape, escapejs
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -20,7 +20,7 @@ class MandatosInline(admin.TabularInline):
raw_id_fields = ('legislatura', 'partido') raw_id_fields = ('legislatura', 'partido')
class TelefonesInline(generic.GenericTabularInline): class TelefonesInline(GenericTabularInline):
model = Telefone model = Telefone
extra = 2 extra = 2

4
sigi/apps/servicos/admin.py

@ -109,11 +109,11 @@ class ServicoAdmin(BaseModelAdmin):
calcular_data_uso.short_description = _(u"Atualizar a data do último uso do(s) serviço(s)") calcular_data_uso.short_description = _(u"Atualizar a data do último uso do(s) serviço(s)")
def get_actions(self, request): def get_actions(self, request):
from django.utils.datastructures import SortedDict from collections import OrderedDict
actions = [self.get_action(action) for action in self.actions] actions = [self.get_action(action) for action in self.actions]
actions = filter(None, actions) actions = filter(None, actions)
actions.sort(lambda a, b: cmp(a[2].lower(), b[2].lower())) actions.sort(lambda a, b: cmp(a[2].lower(), b[2].lower()))
actions = SortedDict([(name, (func, name, desc)) for func, name, desc in actions]) actions = OrderedDict([(name, (func, name, desc)) for func, name, desc in actions])
return actions return actions
def lookup_allowed(self, lookup, value): def lookup_allowed(self, lookup, value):

2
sigi/apps/servicos/models.py

@ -15,7 +15,7 @@ class TipoServico(models.Model):
{url} para incluir a URL do serviço,<br/> {url} para incluir a URL do serviço,<br/>
{senha} para incluir a senha inicial do serviço''' {senha} para incluir a senha inicial do serviço'''
nome = models.CharField(_(u'Nome'), max_length=60) nome = models.CharField(_(u'Nome'), max_length=60)
sigla = models.CharField(_(u'Sigla'), max_length='12') sigla = models.CharField(_(u'Sigla'), max_length=12)
modo = models.CharField(_(u'Modo de prestação do serviço'), max_length=1, choices=MODO_CHOICES) modo = models.CharField(_(u'Modo de prestação do serviço'), max_length=1, choices=MODO_CHOICES)
string_pesquisa = models.CharField(_(u'String de pesquisa'), blank=True, max_length=200, string_pesquisa = models.CharField(_(u'String de pesquisa'), blank=True, max_length=200,
help_text=_(u'Sufixo para pesquisa RSS para averiguar a data da última atualização do serviço')) help_text=_(u'Sufixo para pesquisa RSS para averiguar a data da última atualização do serviço'))

2
sigi/apps/servicos/templates/servicos/mapa.html

@ -7,7 +7,7 @@
{{ block.super }} {{ block.super }}
{% load static from staticfiles %} {% load static from staticfiles %}
<script type="text/javascript" src="{% static "admin/js/core.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/core.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery-1.9.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script> <script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript"> <script type="text/javascript">

2
sigi/apps/servidores/admin.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes import generic from django.contrib.contenttypes import admin as generic
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from sigi.apps.contatos.models import Endereco, Telefone from sigi.apps.contatos.models import Endereco, Telefone

6
sigi/apps/servidores/models.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.contenttypes import generic from django.contrib.contenttypes import fields
from django.db import models from django.db import models
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -105,8 +105,8 @@ class Servidor(models.Model):
# Informações de contato # Informações de contato
email_pessoal = models.EmailField('email pessoal', blank=True, null=True) email_pessoal = models.EmailField('email pessoal', blank=True, null=True)
endereco = generic.GenericRelation('contatos.Endereco') endereco = fields.GenericRelation('contatos.Endereco')
telefones = generic.GenericRelation('contatos.Telefone') telefones = fields.GenericRelation('contatos.Telefone')
ramal = models.CharField(max_length=25, blank=True, null=True) ramal = models.CharField(max_length=25, blank=True, null=True)
class Meta: class Meta:

4
sigi/settings/base.py

@ -30,9 +30,9 @@ MANAGERS = ADMINS
SITE_ID = 1 SITE_ID = 1
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + ( TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + [
'django.core.context_processors.request', 'django.core.context_processors.request',
) ]
# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader', TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',

2
templates/index.html

@ -9,7 +9,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" > <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" >
<script type="text/javascript" src="{% static 'admin/js/core.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/core.js' %}" ></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.min.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/jquery-1.9.1.min.js' %}" ></script>
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script> <script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}" ></script>
<script type="text/javascript" src="{% static 'js/Chart.min.js' %}" ></script> <script type="text/javascript" src="{% static 'js/Chart.min.js' %}" ></script>
<script type="text/javascript" src="{% static 'js/dashboard.js' %}"></script> <script type="text/javascript" src="{% static 'js/dashboard.js' %}"></script>

Loading…
Cancel
Save