Browse Source

Isort

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
c240955dc1
  1. 17
      check_qa.sh
  2. 1
      conftest.py
  3. 10
      etc/migracao/migra.py
  4. 11
      fix_qa.sh
  5. 1
      scripts/casas_com_PM_e_SAPL.py
  6. 5
      scripts/casas_que_usam_LEGBR_ou_PM.py
  7. 4
      scripts/contatos_de_casas_que_usam_portalmodelo.py
  8. 2
      scripts/csv_writer.py
  9. 2
      scripts/importa_pesquisa.py
  10. 1
      scripts/servicos_seit_ate_2013_2014.py
  11. 1
      scripts/setgerentes/dados_gerentes.py
  12. 2
      scripts/user_from_session.py
  13. 4
      scripts/verificacao_arquivos_faltando_media.py
  14. 1
      setup.py
  15. 11
      sigi/apps/casas/admin.py
  16. 5
      sigi/apps/casas/management/commands/importa_gerentes.py
  17. 2
      sigi/apps/casas/models.py
  18. 4
      sigi/apps/casas/reports.py
  19. 1
      sigi/apps/casas/urls.py
  20. 28
      sigi/apps/casas/views.py
  21. 5
      sigi/apps/contatos/admin.py
  22. 6
      sigi/apps/contatos/management/commands/importa_mesomicro.py
  23. 3
      sigi/apps/convenios/admin.py
  24. 1
      sigi/apps/convenios/models.py
  25. 3
      sigi/apps/convenios/reports.py
  26. 1
      sigi/apps/convenios/urls.py
  27. 13
      sigi/apps/convenios/views.py
  28. 5
      sigi/apps/crud/base.py
  29. 1
      sigi/apps/crud/urls.py
  30. 1
      sigi/apps/crud/utils.py
  31. 4
      sigi/apps/diagnosticos/admin.py
  32. 3
      sigi/apps/diagnosticos/decorators.py
  33. 8
      sigi/apps/diagnosticos/forms.py
  34. 3
      sigi/apps/diagnosticos/models.py
  35. 1
      sigi/apps/diagnosticos/templatetags/smart_if.py
  36. 2
      sigi/apps/diagnosticos/templatetags/test_smart_if.py
  37. 1
      sigi/apps/diagnosticos/urls.py
  38. 9
      sigi/apps/diagnosticos/views.py
  39. 8
      sigi/apps/diagnosticos/widgets.py
  40. 9
      sigi/apps/eventos/admin.py
  41. 6
      sigi/apps/eventos/models.py
  42. 1
      sigi/apps/eventos/urls.py
  43. 10
      sigi/apps/eventos/views.py
  44. 1
      sigi/apps/home/templatetags/menus.py
  45. 1
      sigi/apps/home/urls.py
  46. 21
      sigi/apps/home/views.py
  47. 6
      sigi/apps/inventario/admin.py
  48. 1
      sigi/apps/mdl/models.py
  49. 3
      sigi/apps/metas/models.py
  50. 1
      sigi/apps/metas/templatetags/mapa_tags.py
  51. 1
      sigi/apps/metas/urls.py
  52. 3
      sigi/apps/metas/views.py
  53. 3
      sigi/apps/ocorrencias/admin.py
  54. 12
      sigi/apps/ocorrencias/forms.py
  55. 4
      sigi/apps/ocorrencias/models.py
  56. 1
      sigi/apps/ocorrencias/urls.py
  57. 26
      sigi/apps/ocorrencias/views.py
  58. 10
      sigi/apps/parlamentares/admin.py
  59. 4
      sigi/apps/parlamentares/reports.py
  60. 1
      sigi/apps/parlamentares/test_parlamentares.py
  61. 14
      sigi/apps/parlamentares/views.py
  62. 3
      sigi/apps/relatorios/reports.py
  63. 3
      sigi/apps/saberes/admin.py
  64. 7
      sigi/apps/saberes/management/commands/get_moodle_stats.py
  65. 7
      sigi/apps/saberes/models.py
  66. 4
      sigi/apps/saberes/urls.py
  67. 4
      sigi/apps/saberes/views.py
  68. 3
      sigi/apps/servicos/admin.py
  69. 5
      sigi/apps/servicos/models.py
  70. 1
      sigi/apps/servicos/urls.py
  71. 5
      sigi/apps/servicos/views.py
  72. 5
      sigi/apps/servidores/admin.py
  73. 2
      sigi/apps/servidores/forms.py
  74. 4
      sigi/apps/servidores/management/commands/migra.py
  75. 2
      sigi/apps/servidores/management/commands/sync_ldap.py
  76. 1
      sigi/apps/servidores/management/commands/test_sync_ldap.py
  77. 8
      sigi/apps/servidores/test_servidores_forms.py
  78. 1
      sigi/apps/servidores/urls.py
  79. 8
      sigi/apps/servidores/views.py
  80. 1
      sigi/apps/solicitacoes/apps.py
  81. 10
      sigi/apps/solicitacoes/forms.py
  82. 3
      sigi/apps/solicitacoes/models.py
  83. 1
      sigi/apps/solicitacoes/urls.py
  84. 4
      sigi/apps/solicitacoes/views.py
  85. 1
      sigi/apps/usuarios/apps.py
  86. 5
      sigi/apps/usuarios/forms.py
  87. 5
      sigi/apps/usuarios/models.py
  88. 16
      sigi/apps/usuarios/urls.py
  89. 1
      sigi/apps/usuarios/utils.py
  90. 20
      sigi/apps/usuarios/views.py
  91. 8
      sigi/apps/utils/decorators.py
  92. 1
      sigi/apps/utils/filters.py
  93. 2
      sigi/apps/utils/moodle_ws_api.py
  94. 2
      sigi/settings/base.py
  95. 1
      sigi/settings/test.py
  96. 5
      sigi/test_cart.py
  97. 1
      sigi/test_testutils.py
  98. 3
      sigi/testutils.py
  99. 2
      sigi/urls.py
  100. 4
      sigi/wsgi.py

17
check_qa.sh

@ -0,0 +1,17 @@
#!/bin/bash
# Check if there's some debug breakpoint in codebase
me=`basename "$0"`
stmts=`grep --exclude=$me -r -l "ipdb.set_trace()" * | wc -l`
if [ $stmts != '0' ]
then
echo "=================================================================="
echo "ERROR: ipdb.set_trace() call in codebase! Remove, please."
grep --exclude=$me -r -n "ipdb.set_trace()" *
echo "=================================================================="
fi
# QA checks: run this before every commit
./manage.py check
flake8 --exclude='ipython_log.py*,migrations,templates' .
isort --recursive --check-only --skip='migrations' --skip='templates' --skip='ipython_log.py' .

1
conftest.py

@ -2,7 +2,6 @@
import pytest
from django_webtest import DjangoTestApp, WebTestMixin
DEFAULT_MARK = object()

10
etc/migracao/migra.py

@ -19,19 +19,21 @@ pós-instalação) para a migração dos dados. Este script não foi feito para
banco de dados em produção.
"""
import csv
from datetime import datetime
from django.core.management import setup_environ
from sigi import settings
setup_environ(settings)
import csv
from datetime import datetime
from sigi.apps.casas.models import *
from sigi.apps.contatos.models import *
from sigi.apps.convenios.models import *
from sigi.apps.inventario.models import *
from sigi.apps.parlamentares.models import *
setup_environ(settings)
ERROR_MSG_0 = ('<ERRO> %s[%s]: erro desconhecido! Possível erro de integridade '
'do banco de dados. Favor verificar e inserir manualmente caso '
'necessário.')

11
fix_qa.sh

@ -0,0 +1,11 @@
#!/bin/bash
# QA fix: Use ese script para corrigir automaticamente vários
# problemas de estilo e boas práticas no código.
#
# Sempre guarde suas mudanças de alguma forma antes de aplicar esse script,
# de modo que possa revisar cada alteração que ele fez.
# Uma forma simples de fazer isso é adicionando antes suas mudanças à
# "staging area" do git, com `git add .` e após usar o script `git diff`.
isort --recursive --skip='migrations' --skip='templates' --skip='ipython_log.py' .

1
scripts/casas_com_PM_e_SAPL.py

@ -1,7 +1,6 @@
from csv_writer import CsvWriter
from sigi.apps.servicos.models import Servico
ARQUIVO_CSV = '/tmp/casas_que_usam_PM_e_SAPL.csv'

5
scripts/casas_que_usam_LEGBR_ou_PM.py

@ -1,9 +1,8 @@
import cStringIO
import codecs
import cStringIO
import csv
from sigi.apps.servicos.models import TipoServico, Servico
from sigi.apps.servicos.models import Servico, TipoServico
# cria um CSV com contatos das casas legislativas que possuem portal modelo ativo
# rodar em um shell:

4
scripts/contatos_de_casas_que_usam_portalmodelo.py

@ -1,10 +1,10 @@
import cStringIO
import codecs
import cStringIO
import csv
from sigi.apps.casas.models import Funcionario
from sigi.apps.contatos.models import Telefone
from sigi.apps.servicos.models import TipoServico, Servico
from sigi.apps.servicos.models import Servico, TipoServico
# cria um CSV com contatos das casas legislativas que possuem portal modelo ativo
# rodar em um shell:

2
scripts/csv_writer.py

@ -1,5 +1,5 @@
import cStringIO
import codecs
import cStringIO
import csv

2
scripts/importa_pesquisa.py

@ -29,6 +29,7 @@ from datetime import datetime
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.servidores.models import Servidor
def importa(file_list):
''' Este script importa dados de um arquivo CSV e dá carga no model casas.CasaLegislativa
@ -128,4 +129,3 @@ def importa(file_list):
casa.save()
print 'O arquivo '+filename+'.out foi criado com os registros que nao puderam ser importados'

1
scripts/servicos_seit_ate_2013_2014.py

@ -1,4 +1,5 @@
from datetime import date
from django.db.models import Q
from sigi.apps.servicos.models import TipoServico

1
scripts/setgerentes/dados_gerentes.py

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from sigi.apps.servidores.models import Servidor
gerentes = {k: Servidor.objects.get(nome_completo=n) for k, n in (
('ADAL', u'Adalberto Alves de Oliveira'),
('janarycn', u'Janary Carvão Nunes'),

2
scripts/user_from_session.py

@ -1,5 +1,5 @@
from django.contrib.sessions.models import Session
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
def user_from_session(session_key):

4
scripts/verificacao_arquivos_faltando_media.py

@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
from datetime import datetime
# Dependência:
# pip install terminaltables
from os.path import isfile
from datetime import datetime
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from terminaltables import AsciiTable
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.convenios.models import Anexo as AnexoConvenios
@ -15,6 +14,7 @@ from sigi.apps.diagnosticos.models import Anexo as AnexoDiagnosticos
from sigi.apps.ocorrencias.models import Anexo as AnexoOcorrencias
from sigi.apps.parlamentares.models import Parlamentar
from sigi.apps.servidores.models import Servidor
from terminaltables import AsciiTable
def print_table(msg, relacao):

1
setup.py

@ -4,5 +4,4 @@
#
from distutils.core import setup
setup(name='sigi', version='2.x')

11
sigi/apps/casas/admin.py

@ -1,16 +1,17 @@
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from image_cropping import ImageCroppingMixin
from sigi.apps.casas.forms import CasaLegislativaForm
from sigi.apps.casas.models import CasaLegislativa, Presidente, Funcionario, TipoCasaLegislativa
from sigi.apps.casas.views import report_complete, labels_report, export_csv, \
labels_report_sem_presidente, report, \
adicionar_casas_carrinho
from sigi.apps.casas.models import (CasaLegislativa, Funcionario, Presidente,
TipoCasaLegislativa)
from sigi.apps.casas.views import (adicionar_casas_carrinho, export_csv,
labels_report, labels_report_sem_presidente,
report, report_complete)
from sigi.apps.contatos.models import Telefone
from sigi.apps.convenios.models import Convenio
from sigi.apps.diagnosticos.models import Diagnostico

5
sigi/apps/casas/management/commands/importa_gerentes.py

@ -24,10 +24,13 @@
import csv
import os
from django.core.management.base import BaseCommand, CommandError
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.servidores.models import Servidor
from sigi.apps.contatos.models import Municipio
from sigi.apps.servidores.models import Servidor
class Command(BaseCommand):
args = u"data_file.csv"

2
sigi/apps/casas/models.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
import random
from datetime import datetime
from string import ascii_uppercase
from unicodedata import normalize
from datetime import datetime
from django.contrib.contenttypes import fields
from django.db import models
from image_cropping import ImageRatioField

4
sigi/apps/casas/reports.py

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
from django.templatetags.static import static
from django.utils.translation import ugettext as _
from geraldo import Report, DetailBand, Label, ObjectValue, ReportGroup, ReportBand, landscape, SubReport, BAND_WIDTH, SystemField
from geraldo import (BAND_WIDTH, DetailBand, Label, ObjectValue, Report,
ReportBand, ReportGroup, SubReport, SystemField,
landscape)
from geraldo.graphics import Image
from reportlab.lib.enums import TA_CENTER
from reportlab.lib.pagesizes import A4

1
sigi/apps/casas/urls.py

@ -1,7 +1,6 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.casas.views',

28
sigi/apps/casas/views.py

@ -2,23 +2,29 @@
import csv
from functools import reduce
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render, get_object_or_404
from django.utils.translation import ugettext as _, ungettext
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage, InvalidPage, Paginator
from django.db.models import Count, Q
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.http.response import JsonResponse
from django.shortcuts import get_object_or_404, render
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from geraldo.generators import PDFGenerator
from sigi.apps.casas.forms import PortfolioForm
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.casas.reports import CasasLegislativasLabels, CasasLegislativasLabelsSemPresidente, CasasLegislativasReport, CasasSemConvenioReport, InfoCasaLegislativa
from sigi.apps.casas.reports import (CasasLegislativasLabels,
CasasLegislativasLabelsSemPresidente,
CasasLegislativasReport,
CasasSemConvenioReport,
InfoCasaLegislativa)
from sigi.apps.contatos.models import (Mesorregiao, Microrregiao,
UnidadeFederativa)
from sigi.apps.ocorrencias.models import Ocorrencia
from sigi.apps.parlamentares.reports import ParlamentaresLabels
from sigi.apps.contatos.models import UnidadeFederativa, Mesorregiao, Microrregiao
from sigi.apps.casas.forms import PortfolioForm
from django.contrib.auth.decorators import login_required
from sigi.apps.servicos.models import TipoServico
from sigi.apps.servidores.models import Servidor
from sigi.apps.ocorrencias.models import Ocorrencia
from django.db.models import Count, Q
from django.http.response import JsonResponse
# @param qs: queryset

5
sigi/apps/contatos/admin.py

@ -3,11 +3,12 @@ from django.contrib import admin
from django.utils.translation import ugettext as _
from sigi.apps.contatos.filters import PopulationFilter
from sigi.apps.contatos.models import (UnidadeFederativa, Mesorregiao, Microrregiao,
Municipio, Telefone, Contato)
from sigi.apps.contatos.models import (Contato, Mesorregiao, Microrregiao,
Municipio, Telefone, UnidadeFederativa)
from sigi.apps.utils import queryset_ascii
from sigi.apps.utils.base_admin import BaseModelAdmin
class MesorregiaoInline(admin.TabularInline):
model = Mesorregiao

6
sigi/apps/contatos/management/commands/importa_mesomicro.py

@ -23,8 +23,12 @@
#
import csv
import os
from django.core.management.base import BaseCommand, CommandError
from sigi.apps.contatos.models import Municipio, UnidadeFederativa, Mesorregiao, Microrregiao
from sigi.apps.contatos.models import (Mesorregiao, Microrregiao, Municipio,
UnidadeFederativa)
class Command(BaseCommand):
args = u"data_file.csv"

3
sigi/apps/convenios/admin.py

@ -4,7 +4,8 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.utils.translation import ugettext as _
from geraldo.generators import PDFGenerator
from sigi.apps.convenios.models import Projeto, Convenio, EquipamentoPrevisto, Anexo, Tramitacao
from sigi.apps.convenios.models import (Anexo, Convenio, EquipamentoPrevisto,
Projeto, Tramitacao)
from sigi.apps.convenios.reports import ConvenioReport
from sigi.apps.convenios.views import adicionar_convenios_carrinho
from sigi.apps.utils import queryset_ascii

1
sigi/apps/convenios/models.py

@ -1,5 +1,6 @@
# style="list-style-type: noneo -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _

3
sigi/apps/convenios/reports.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from geraldo import ReportBand, ObjectValue, Label, ReportGroup, FIELD_ACTION_SUM
from geraldo import (FIELD_ACTION_SUM, Label, ObjectValue, ReportBand,
ReportGroup)
from reportlab.lib.units import cm
from sigi.apps.relatorios.reports import ReportDefault

1
sigi/apps/convenios/urls.py

@ -1,7 +1,6 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.convenios.views',

13
sigi/apps/convenios/views.py

@ -1,12 +1,13 @@
#-*- coding:utf-8 -*-
import csv
import datetime
import ho.pisa as pisa
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage, InvalidPage, Paginator
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_list_or_404
from django.shortcuts import get_list_or_404, render
from django.template import Context, loader
from django.utils.translation import ugettext as _
from geraldo.generators import PDFGenerator
@ -14,8 +15,10 @@ from geraldo.generators import PDFGenerator
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.contatos.models import UnidadeFederativa
from sigi.apps.convenios.models import Convenio, Projeto
from sigi.apps.convenios.reports import ConvenioPorCMReport, ConvenioPorALReport, ConvenioReportSemAceiteAL, ConvenioReportSemAceiteCM
from django.contrib.auth.decorators import login_required
from sigi.apps.convenios.reports import (ConvenioPorALReport,
ConvenioPorCMReport,
ConvenioReportSemAceiteAL,
ConvenioReportSemAceiteCM)
def query_ordena(qs, o, ot):

5
sigi/apps/crud/base.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from braces.views import FormMessagesMixin
from django.conf.urls import url
from django.core.urlresolvers import reverse
@ -9,8 +10,10 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import (CreateView, DeleteView, DetailView, ListView,
UpdateView)
from sigi.apps.crispy_layout_mixin import (CrispyLayoutFormMixin,
get_field_display)
from .utils import make_pagination
from sigi.apps.crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display
LIST, CREATE, DETAIL, UPDATE, DELETE = \
u'list', u'create', u'detail', u'update', u'delete'

1
sigi/apps/crud/urls.py

@ -1,4 +1,5 @@
from __future__ import absolute_import
from django.conf.urls import include, url
urlpatterns = [

1
sigi/apps/crud/utils.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
UF = [

4
sigi/apps/diagnosticos/admin.py

@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from django.contrib import admin
from django.db.utils import OperationalError, ProgrammingError
from django.utils.translation import ugettext as _
from eav.admin import BaseEntityAdmin, BaseSchemaAdmin
from sigi.apps.diagnosticos.forms import DiagnosticoForm
from sigi.apps.diagnosticos.models import Diagnostico, Pergunta, Escolha, Equipe, Anexo, Categoria
from sigi.apps.diagnosticos.models import (Anexo, Categoria, Diagnostico,
Equipe, Escolha, Pergunta)
from sigi.apps.utils.base_admin import BaseModelAdmin

3
sigi/apps/diagnosticos/decorators.py

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.template import RequestContext
from sigi.apps.diagnosticos.models import Diagnostico

8
sigi/apps/diagnosticos/forms.py

@ -3,9 +3,8 @@ from copy import deepcopy
from django import forms
from django.contrib.contenttypes.forms import generic_inlineformset_factory
from django.forms import (BooleanField, CharField, DateField,
FloatField, ModelChoiceField, Textarea,
ModelMultipleChoiceField)
from django.forms import (BooleanField, CharField, DateField, FloatField,
ModelChoiceField, ModelMultipleChoiceField, Textarea)
from django.forms.forms import BoundField
from django.utils.translation import ugettext as _
from eav.fields import RangeField
@ -14,7 +13,8 @@ from eav.forms import BaseDynamicEntityForm
from sigi.apps.casas.models import CasaLegislativa, Funcionario
from sigi.apps.contatos.models import Telefone
from sigi.apps.diagnosticos.models import Diagnostico
from sigi.apps.diagnosticos.widgets import EavCheckboxSelectMultiple, EavRadioSelect
from sigi.apps.diagnosticos.widgets import (EavCheckboxSelectMultiple,
EavRadioSelect)
class DiagnosticoForm(BaseDynamicEntityForm):

3
sigi/apps/diagnosticos/models.py

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _
from eav.models import BaseChoice, BaseEntity, BaseSchema, BaseAttribute
from eav.models import BaseAttribute, BaseChoice, BaseEntity, BaseSchema
from sigi.apps.utils import SearchField
from sigi.apps.utils.email import enviar_email

1
sigi/apps/diagnosticos/templatetags/smart_if.py

@ -9,7 +9,6 @@ greater than and less than operators. Some common case examples::
"""
from django import template
register = template.Library()

2
sigi/apps/diagnosticos/templatetags/test_smart_if.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import pytest
from smart_if import Or, And, Equals, Greater, GreaterOrEqual, In, IfParser
from smart_if import And, Equals, Greater, GreaterOrEqual, IfParser, In, Or
class TestVar(object):

1
sigi/apps/diagnosticos/urls.py

@ -2,7 +2,6 @@
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
LOGIN_REDIRECT_URL = '/diagnosticos/mobile/login'
urlpatterns = patterns(

9
sigi/apps/diagnosticos/views.py

@ -3,7 +3,7 @@ import json as simplejson # XXX trocar isso por simplesmente import json e refa
from itertools import cycle
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
@ -11,9 +11,10 @@ from django.views.decorators.cache import never_cache
from sigi.apps.casas.models import Funcionario
from sigi.apps.contatos.models import Telefone
from sigi.apps.diagnosticos.decorators import validate_diagnostico
from sigi.apps.diagnosticos.forms import (DiagnosticoMobileForm,
CasaLegislativaMobileForm, FuncionariosMobileForm)
from sigi.apps.diagnosticos.models import Diagnostico, Categoria, Pergunta
from sigi.apps.diagnosticos.forms import (CasaLegislativaMobileForm,
DiagnosticoMobileForm,
FuncionariosMobileForm)
from sigi.apps.diagnosticos.models import Categoria, Diagnostico, Pergunta
from sigi.apps.diagnosticos.urls import LOGIN_REDIRECT_URL
from sigi.apps.utils.decorators import login_required
from sigi.shortcuts import render_to_pdf

8
sigi/apps/diagnosticos/widgets.py

@ -1,8 +1,12 @@
from itertools import chain
from django.forms.widgets import CheckboxInput, CheckboxSelectMultiple, RadioSelect, RadioFieldRenderer, RadioChoiceInput
from django.utils.html import conditional_escape
from django.forms.widgets import (CheckboxInput, CheckboxSelectMultiple,
RadioChoiceInput, RadioFieldRenderer,
RadioSelect)
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from sigi.apps.diagnosticos.models import Escolha

9
sigi/apps/eventos/admin.py

@ -18,10 +18,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from django.contrib import admin
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext as _
from sigi.apps.eventos.models import TipoEvento, Funcao, Evento, Equipe, Convite
from sigi.apps.eventos.models import (Convite, Equipe, Evento, Funcao,
TipoEvento)
class EventoAdminForm(forms.ModelForm):
class Meta:
@ -67,5 +70,3 @@ class EventoAdmin(admin.ModelAdmin):
search_fields = ('nome', 'tipo_evento__nome', 'casa_anfitria__search_text',
'municipio__search_text', 'solicitante')
inlines = (EquipeInline, ConviteInline)

6
sigi/apps/eventos/models.py

@ -18,15 +18,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.functional import lazy
from django.utils.translation import ugettext as _
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.contatos.models import Municipio
from sigi.apps.mdl.models import Course
from sigi.apps.servidores.models import Servidor
from sigi.apps.utils.moodle_ws_api import get_courses
from django.core.exceptions import ValidationError
from sigi.apps.mdl.models import Course
class TipoEvento(models.Model):
nome = models.CharField(_(u"Nome"), max_length=100)

1
sigi/apps/eventos/urls.py

@ -1,7 +1,6 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.eventos.views',
# Painel de ocorrencias

10
sigi/apps/eventos/views.py

@ -19,17 +19,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import calendar
import csv
import datetime
import locale
from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponse, JsonResponse
from django.shortcuts import render
from django.utils import translation
from django.utils.translation import ungettext, ugettext as _
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from sigi.apps.eventos.models import Evento
from sigi.apps.servidores.models import Servidor
from sigi.shortcuts import render_to_pdf
import csv
from django.http.response import JsonResponse, HttpResponse
@login_required
def calendario(request):

1
sigi/apps/home/templatetags/menus.py

@ -3,7 +3,6 @@ from os.path import dirname
import yaml
from django import template
register = template.Library()
menus = yaml.load(open(dirname(__file__) + '/menu_conf.yaml', 'r'))

1
sigi/apps/home/urls.py

@ -2,7 +2,6 @@
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
urlpatterns = patterns(
'sigi.apps.home.views',
url(r'^home/atendimento', TemplateView.as_view(

21
sigi/apps/home/views.py

@ -22,24 +22,27 @@
# 02110-1301, USA.
#
import datetime
import calendar
from django.shortcuts import render, get_object_or_404
from django.utils.translation import ugettext as _
import csv
import datetime
from itertools import cycle
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db.models import Count, Q
from django.http.response import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.convenios.models import Convenio, Projeto
from sigi.apps.diagnosticos.models import Diagnostico
from sigi.apps.metas.models import Meta
from sigi.apps.servicos.models import TipoServico
from sigi.apps.servidores.models import Servidor
from django.views.decorators.cache import never_cache
from django.contrib.auth.decorators import login_required
from django.http.response import JsonResponse, HttpResponse
from django.core.urlresolvers import reverse
from django.db.models import Q, Count
from sigi.shortcuts import render_to_pdf
import csv
@never_cache
@login_required

6
sigi/apps/inventario/admin.py

@ -3,9 +3,9 @@ from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from sigi.apps.contatos.models import Contato, Telefone
from sigi.apps.inventario.models import (Fornecedor, Fabricante, Equipamento,
TipoEquipamento, ModeloEquipamento,
Bem)
from sigi.apps.inventario.models import (Bem, Equipamento, Fabricante,
Fornecedor, ModeloEquipamento,
TipoEquipamento)
from sigi.apps.utils.base_admin import BaseModelAdmin

1
sigi/apps/mdl/models.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

3
sigi/apps/metas/models.py

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from datetime import date
from django.db import models
from django.utils.translation import ugettext as _
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.convenios.models import Projeto, Convenio
from sigi.apps.convenios.models import Convenio, Projeto
from sigi.apps.diagnosticos.models import Diagnostico
from sigi.apps.financeiro.models import Desembolso

1
sigi/apps/metas/templatetags/mapa_tags.py

@ -5,7 +5,6 @@ from django.utils.safestring import mark_safe
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.metas.views import parliament_summary
register = template.Library()

1
sigi/apps/metas/urls.py

@ -1,7 +1,6 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.metas.views',

3
sigi/apps/metas/views.py

@ -3,6 +3,7 @@ import csv
import json as simplejson # XXX trocar isso por simplesmente import json e refatorar o codigo
import os
import time
from collections import OrderedDict
from functools import reduce
from django.contrib.auth.decorators import login_required
@ -12,7 +13,6 @@ from django.db.models.aggregates import Sum
from django.http import HttpResponse
from django.shortcuts import render, render_to_response
from django.template import RequestContext
from collections import OrderedDict
from django.utils.translation import ugettext as _
from django.views.decorators.cache import cache_page
from easy_thumbnails.templatetags.thumbnail import thumbnail_url
@ -26,7 +26,6 @@ from sigi.apps.utils import to_ascii
from sigi.settings import MEDIA_ROOT, STATIC_URL
from sigi.shortcuts import render_to_pdf
JSON_FILE_NAME = os.path.join(MEDIA_ROOT, 'apps/metas/map_data.json')

3
sigi/apps/ocorrencias/admin.py

@ -4,7 +4,8 @@ from django.contrib.admin.views.main import ChangeList
from django.utils.translation import ugettext as _
from filters import OcorrenciaListFilter
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo, Categoria, TipoContato
from sigi.apps.ocorrencias.models import (Anexo, Categoria, Comentario,
Ocorrencia, TipoContato)
from sigi.apps.servidores.models import Servidor
from sigi.apps.utils.base_admin import BaseModelAdmin

12
sigi/apps/ocorrencias/forms.py

@ -21,15 +21,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from django.forms import ModelForm, ModelChoiceField, HiddenInput, TextInput
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo
from sigi.apps.servidores.models import Servico
from django.core.urlresolvers import reverse_lazy
from django.forms import HiddenInput, ModelChoiceField, ModelForm, TextInput
from django.forms.utils import flatatt
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.forms.utils import flatatt
from django.core.urlresolvers import reverse_lazy
from django.utils.safestring import mark_safe
from sigi.apps.ocorrencias.models import Anexo, Comentario, Ocorrencia
from sigi.apps.servidores.models import Servico
class AjaxSelect(TextInput):
url = ""
def __init__(self, url, attrs=None):

4
sigi/apps/ocorrencias/models.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
class Categoria(models.Model):

1
sigi/apps/ocorrencias/urls.py

@ -1,7 +1,6 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.ocorrencias.views',
# Painel de ocorrencias

26
sigi/apps/ocorrencias/views.py

@ -1,19 +1,23 @@
# -*- coding: utf-8 -*-
from django.http import JsonResponse, Http404
from django.db.models import Q, Count
from django.utils.translation import ungettext, ugettext as _
from django.shortcuts import get_object_or_404, render, HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.template.loader import render_to_string
from django.db.models import Count, Q
from django.http import Http404, JsonResponse
from django.shortcuts import HttpResponse, get_object_or_404, render
from django.template import RequestContext
from sigi.apps.utils import to_ascii
from django.template.loader import render_to_string
from django.utils.html import escape
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from django.views.decorators.http import require_POST
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.contatos.models import UnidadeFederativa
from sigi.apps.servidores.models import Servidor, Servico
from sigi.apps.ocorrencias.models import Ocorrencia, Anexo
from sigi.apps.ocorrencias.forms import AnexoForm, ComentarioForm, OcorrenciaForm
from django.utils.html import escape
from sigi.apps.ocorrencias.forms import (AnexoForm, ComentarioForm,
OcorrenciaForm)
from sigi.apps.ocorrencias.models import Anexo, Ocorrencia
from sigi.apps.servidores.models import Servico, Servidor
from sigi.apps.utils import to_ascii
@login_required
def painel_ocorrencias(request):

10
sigi/apps/parlamentares/admin.py

@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from django.http import HttpResponseRedirect, HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from django.utils.html import escape, escapejs
from django.utils.translation import ugettext as _
from sigi.apps.contatos.models import Telefone
from sigi.apps.parlamentares.models import (
Partido, Parlamentar, Mandato, Legislatura, Coligacao, ComposicaoColigacao,
SessaoLegislativa, MesaDiretora, Cargo, MembroMesaDiretora)
from sigi.apps.parlamentares.models import (Cargo, Coligacao,
ComposicaoColigacao, Legislatura,
Mandato, MembroMesaDiretora,
MesaDiretora, Parlamentar, Partido,
SessaoLegislativa)
from sigi.apps.parlamentares.views import adicionar_parlamentar_carrinho
from sigi.apps.utils.base_admin import BaseModelAdmin
from sigi.apps.utils.filters import AlphabeticFilter

4
sigi/apps/parlamentares/reports.py

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
from django.templatetags.static import static
from django.utils.translation import ugettext as _
from geraldo import Report, DetailBand, Label, ObjectValue, ReportGroup, ReportBand, landscape, SubReport, BAND_WIDTH, SystemField
from geraldo import (BAND_WIDTH, DetailBand, Label, ObjectValue, Report,
ReportBand, ReportGroup, SubReport, SystemField,
landscape)
from geraldo.graphics import Image
from reportlab.lib.enums import TA_CENTER
from reportlab.lib.pagesizes import A4

1
sigi/apps/parlamentares/test_parlamentares.py

@ -4,7 +4,6 @@ from django_dynamic_fixture import G
from sigi.apps.parlamentares.models import Parlamentar
pytestmark = pytest.mark.django_db

14
sigi/apps/parlamentares/views.py

@ -1,22 +1,20 @@
# coding: utf-8
import datetime
import csv
import datetime
from django.template import Context, loader
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.conf import settings
from django.shortcuts import render, get_list_or_404
from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage, InvalidPage, Paginator
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_list_or_404, render
from django.template import Context, RequestContext, loader
from django.views.decorators.csrf import csrf_protect
from django.template import RequestContext
from geraldo.generators import PDFGenerator
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.parlamentares.models import Parlamentar
from sigi.apps.parlamentares.reports import ParlamentaresLabels
from geraldo.generators import PDFGenerator
from django.contrib.auth.decorators import login_required
def adicionar_parlamentar_carrinho(request, queryset=None, id=None):
if request.method == 'POST':

3
sigi/apps/relatorios/reports.py

@ -3,7 +3,8 @@ import os
from django.templatetags.static import static
from django.utils.translation import ugettext as _
from geraldo import Report, ReportBand, ObjectValue, DetailBand, Label, SystemField, BAND_WIDTH, FIELD_ACTION_COUNT, Line
from geraldo import (BAND_WIDTH, FIELD_ACTION_COUNT, DetailBand, Label, Line,
ObjectValue, Report, ReportBand, SystemField)
from geraldo.graphics import Image
from reportlab.lib.colors import navy
from reportlab.lib.enums import TA_CENTER, TA_RIGHT

3
sigi/apps/saberes/admin.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.utils.translation import ugettext as _
from sigi.apps.saberes.models import CategoriasInteresse

7
sigi/apps/saberes/management/commands/get_moodle_stats.py

@ -21,12 +21,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
from django.utils.translation import ugettext as _
from django.core.management.base import BaseCommand
from django.db.models import Sum, Avg
from django.db.models import Avg, Sum
from django.utils.translation import ugettext as _
from sigi.apps.mdl.models import CourseStats, User
from sigi.apps.metas.views import gera_map_data_file
from sigi.apps.saberes.models import CategoriasInteresse, PainelItem
from sigi.apps.mdl.models import User, CourseStats
class Command(BaseCommand):

7
sigi/apps/saberes/models.py

@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.db import models
from django.db.models import Q
from sigi.apps.mdl.models import Course, CourseCategories, CourseCompletions, UserEnrolments
from django.utils.translation import ugettext as _
from sigi.apps.mdl.models import (Course, CourseCategories, CourseCompletions,
UserEnrolments)
class CategoriasInteresse(models.Model):

4
sigi/apps/saberes/urls.py

@ -1,8 +1,8 @@
# coding: utf-8
from django.conf.urls import patterns, url
from .views import cursos_sem_tutoria, cursos_com_tutoria, dashboard, pentaho_proxy
from .views import (cursos_com_tutoria, cursos_sem_tutoria, dashboard,
pentaho_proxy)
urlpatterns = patterns(
'sigi.apps.saberes.views',

4
sigi/apps/saberes/views.py

@ -5,8 +5,8 @@ from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from requests.auth import HTTPBasicAuth
from sigi.settings import PENTAHO_SERVER, PENTAHO_DASHBOARDS, PENTAHO_USERNAME_PASSWORD
from sigi.settings import (PENTAHO_DASHBOARDS, PENTAHO_SERVER,
PENTAHO_USERNAME_PASSWORD)
PENTAHO_CDF_URL = 'http://%s/pentaho/plugin/pentaho-cdf-dd/api/renderer/' % PENTAHO_SERVER

3
sigi/apps/servicos/admin.py

@ -8,7 +8,8 @@ from django.utils.translation import ugettext as _
from sigi.apps.casas.admin import FuncionariosInline
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.servicos.models import Servico, LogServico, CasaAtendida, TipoServico
from sigi.apps.servicos.models import (CasaAtendida, LogServico, Servico,
TipoServico)
from sigi.apps.utils.base_admin import BaseModelAdmin

5
sigi/apps/servicos/models.py

@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
from datetime import date
from django.db import models
from sigi.apps.casas.models import CasaLegislativa, Funcionario
from django.utils.translation import ugettext as _
from sigi.apps.casas.models import CasaLegislativa, Funcionario
class TipoServico(models.Model):
MODO_CHOICES = (
@ -219,4 +221,3 @@ class RegistroServico(models.Model):
class Meta:
verbose_name_plural = _(u'Registro de serviços')

1
sigi/apps/servicos/urls.py

@ -4,7 +4,6 @@ from django.views.generic.base import TemplateView
from .views import MapaView
urlpatterns = patterns(
'sigi.apps.servicos.views',

5
sigi/apps/servicos/views.py

@ -5,14 +5,15 @@ from django import forms
from django.db.models import Q
from django.forms.forms import BoundField
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import get_object_or_404, render_to_response
from django.template.context import RequestContext
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateView
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.contatos.models import UnidadeFederativa
from sigi.apps.servicos.models import TipoServico, CasaAtendida, CasaManifesta, ServicoManifesto
from sigi.apps.servicos.models import (CasaAtendida, CasaManifesta,
ServicoManifesto, TipoServico)
class MapaView(TemplateView):

5
sigi/apps/servidores/admin.py

@ -4,8 +4,9 @@ from django.contrib.contenttypes import admin as generic
from django.utils.translation import ugettext as _
from sigi.apps.contatos.models import Endereco, Telefone
from sigi.apps.servidores.forms import FeriasForm, LicencaForm, FuncaoForm
from sigi.apps.servidores.models import Servidor, Funcao, Licenca, Ferias, Servico, Subsecretaria
from sigi.apps.servidores.forms import FeriasForm, FuncaoForm, LicencaForm
from sigi.apps.servidores.models import (Ferias, Funcao, Licenca, Servico,
Servidor, Subsecretaria)
from sigi.apps.utils.admin_widgets import AdminImageWidget
from sigi.apps.utils.base_admin import BaseModelAdmin
from sigi.apps.utils.filters import AlphabeticFilter

2
sigi/apps/servidores/forms.py

@ -4,7 +4,7 @@ from collections import namedtuple
from django import forms
from django.utils.translation import ugettext as _
from sigi.apps.servidores.models import Ferias, Licenca, Funcao, Servidor
from sigi.apps.servidores.models import Ferias, Funcao, Licenca, Servidor
def valida_data_inicial_menor_que_final(data, chave_ini, chave_fim):

4
sigi/apps/servidores/management/commands/migra.py

@ -1,14 +1,14 @@
# coding= utf-8
import csv
import re
from datetime import datetime
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from sigi.apps.contatos.models import Municipio
from sigi.apps.servidores.models import Servidor, Servico, Subsecretaria
from sigi.apps.servidores.models import Servico, Servidor, Subsecretaria
# Funcao.objects.all().delete()

2
sigi/apps/servidores/management/commands/sync_ldap.py

@ -1,6 +1,6 @@
# coding: utf-8
import ldap
from django.contrib.auth.models import User, Group
from django.contrib.auth.models import Group, User
from django.core.management.base import BaseCommand
from sigi.apps.servidores.models import Servidor

1
sigi/apps/servidores/management/commands/test_sync_ldap.py

@ -5,7 +5,6 @@ from django_dynamic_fixture import G
from sigi.apps.servidores.management.commands.sync_ldap import Command
pytestmark = pytest.mark.django_db

8
sigi/apps/servidores/test_servidores_forms.py

@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
from django import forms
import pytest
from datetime import date
from sigi.apps.servidores.forms import valida_data_inicial_menor_que_final, Periodo, periodos_se_sobrepoe
import pytest
from django import forms
from sigi.apps.servidores.forms import (Periodo, periodos_se_sobrepoe,
valida_data_inicial_menor_que_final)
@pytest.mark.parametrize('data', [

1
sigi/apps/servidores/urls.py

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns(
'sigi.apps.servidores.views',

8
sigi/apps/servidores/views.py

@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
import new
from django.db.models import Avg, Count, Max, Min
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.db.models import Avg, Max, Min, Count
from sigi.apps.servidores.models import Servidor, Funcao
from sigi.apps.servidores.models import Funcao, Servidor
from sigi.shortcuts import render_to_pdf

1
sigi/apps/solicitacoes/apps.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django import apps
from django.utils.translation import ugettext_lazy as _

10
sigi/apps/solicitacoes/forms.py

@ -1,11 +1,15 @@
from __future__ import absolute_import
from django.db import transaction
import json
import requests
from django import forms
from django.db import transaction
from django.forms import ModelForm
from sigi.settings.prod import OSTICKET_API_KEY, OSTICKET_URL
from .models import Solicitacao
import json
import requests
def open_osticket(solicitacao):

3
sigi/apps/solicitacoes/models.py

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.db import models
from django.utils.translation import ugettext_lazy as _
from sigi.apps.usuarios.models import Usuario
from sigi.apps.servicos.models import TipoServico
from sigi.apps.usuarios.models import Usuario
class Solicitacao(models.Model):

1
sigi/apps/solicitacoes/urls.py

@ -1,4 +1,5 @@
from __future__ import absolute_import
from django.conf.urls import include, url
from sigi.apps.solicitacoes.views import SolicitacaoCrud

4
sigi/apps/solicitacoes/views.py

@ -1,11 +1,13 @@
from __future__ import absolute_import
import random
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse
import sigi.apps.crud.base
from sigi.apps.crud.base import Crud, CrudCreateView, CrudListView, CrudCreateView, CrudUpdateView, CrudBaseMixin
from sigi.apps.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudListView, CrudUpdateView)
from sigi.apps.usuarios.models import Usuario
from .forms import SolicitacaoForm

1
sigi/apps/usuarios/apps.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django import apps
from django.utils.translation import ugettext_lazy as _

5
sigi/apps/usuarios/forms.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
from captcha.fields import CaptchaField
@ -14,12 +15,12 @@ from django.core.exceptions import ValidationError
from django.db import transaction
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
from sigi.apps.casas.models import CasaLegislativa
from easy_select2 import Select2
import sigi.apps.crispy_layout_mixin
from sigi.apps.crud.utils import YES_NO_CHOICES
from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.crispy_layout_mixin import form_actions
from sigi.apps.crud.utils import YES_NO_CHOICES
from .models import Telefone, Usuario

5
sigi/apps/usuarios/models.py

@ -1,12 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import base64
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from sigi.apps.utils import SearchField
from sigi.apps.crud.utils import UF, YES_NO_CHOICES
from sigi.apps.utils import SearchField
class Subsecretaria(models.Model):

16
sigi/apps/usuarios/urls.py

@ -1,16 +1,18 @@
from __future__ import absolute_import
from django.conf.urls import include, url
from django.contrib.auth.views import (login, logout, password_reset,
password_reset_done,
password_reset_complete,
password_reset_confirm,
password_reset_complete)
from sigi.apps.usuarios.forms import (LoginForm, RecuperarSenhaEmailForm,
RecuperacaoMudarSenhaForm)
from sigi.apps.usuarios.views import (HabilitarDetailView, HabilitarEditView,
MudarSenhaView, UsuarioCrud,
ConfirmarEmailView)
password_reset_done)
from django.views.generic.base import TemplateView
from sigi.apps.usuarios.forms import (LoginForm, RecuperacaoMudarSenhaForm,
RecuperarSenhaEmailForm)
from sigi.apps.usuarios.views import (ConfirmarEmailView, HabilitarDetailView,
HabilitarEditView, MudarSenhaView,
UsuarioCrud)
from .apps import AppConfig
app_name = AppConfig.name

1
sigi/apps/usuarios/utils.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
UF = [

20
sigi/apps/usuarios/views.py

@ -1,25 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from braces.views import FormValidMessageMixin
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.tokens import default_token_generator
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.utils import timezone
from django.views.generic import DetailView, FormView, TemplateView
from django.core.mail import send_mail
from sigi.apps.crud.utils import str2bool
from django.contrib.auth.tokens import default_token_generator
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
from django.views.generic import DetailView, FormView, TemplateView
from sigi.apps.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudListView, CrudUpdateView, CrudDetailView)
CrudDetailView, CrudListView, CrudUpdateView)
from sigi.apps.crud.utils import str2bool
from .forms import (HabilitarEditForm, MudarSenhaForm, UsuarioEditForm,
UsuarioForm)
from .models import Usuario, ConfirmaEmail, User
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from .models import ConfirmaEmail, User, Usuario
class UsuarioCrud(Crud):

8
sigi/apps/utils/decorators.py

@ -11,14 +11,16 @@ obsoleto.
"""
import urlparse
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.decorators import available_attrs
def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):

1
sigi/apps/utils/filters.py

@ -1,5 +1,6 @@
# coding: utf-8
import string
from django.contrib import admin

2
sigi/apps/utils/moodle_ws_api.py

@ -20,8 +20,10 @@
import json
import urllib2
from django.conf import settings
def get_courses(ids=[], sort_order='', *args, **kwargs):
''' Implements core_courses_get_courses function
@param ids: list of course ids to retrieve, blank for all courses

2
sigi/settings/base.py

@ -14,6 +14,7 @@ import os
from os.path import dirname
import django.conf.global_settings as DEFAULT_SETTINGS
from easy_thumbnails.conf import Settings as thumbnail_settings
BASE_DIR = dirname(dirname(dirname(__file__)))
@ -152,7 +153,6 @@ LOGIN_URL = '/login/?next='
# Using pytest directly (without a test runner)
TEST_RUNNER = None
from easy_thumbnails.conf import Settings as thumbnail_settings
THUMBNAIL_PROCESSORS = (
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS

1
sigi/settings/test.py

@ -1,6 +1,5 @@
from base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '0$ip1fb5xtq%a=)-k_4r^(#jn0t^@+*^kihkxkozg-mip7+w3+'

5
sigi/test_cart.py

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import pytest
from sigi.apps.casas.test_casas import some_parliaments, parliaments_from_names
from sigi.apps.parlamentares.test_parlamentares import some_parliamentarians, parliamentarians_from_names
from sigi.apps.casas.test_casas import parliaments_from_names, some_parliaments
from sigi.apps.parlamentares.test_parlamentares import (parliamentarians_from_names,
some_parliamentarians)
from sigi.testutils import pdf_text

1
sigi/test_testutils.py

@ -2,7 +2,6 @@ from collections import namedtuple
from sigi.testutils import SigiDataFixture
FieldStub = namedtuple('FieldStub', ['max_length'])

3
sigi/testutils.py

@ -3,7 +3,8 @@ from cStringIO import StringIO
from itertools import product
import pyPdf
from django_dynamic_fixture.fixture_algorithms.sequential_fixture import SequentialDataFixture
from django_dynamic_fixture.fixture_algorithms.sequential_fixture import \
SequentialDataFixture
def pdf_text(res):

2
sigi/urls.py

@ -1,7 +1,7 @@
#-*- coding:utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic.base import TemplateView

4
sigi/wsgi.py

@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sigi.settings")
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sigi.settings")
application = get_wsgi_application()

Loading…
Cancel
Save