Browse Source

Adicionando o campo de gerente de contas

producao
Breno Teixeira 11 years ago
parent
commit
46dfa02f58
  1. 19
      sigi/apps/casas/admin.py
  2. 14
      sigi/apps/casas/models.py

19
sigi/apps/casas/admin.py

@ -1,26 +1,23 @@
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.contenttypes import generic
from django.http import HttpResponse, HttpResponseRedirect
from django.http import HttpResponseRedirect
from geraldo.generators import PDFGenerator
from sigi.apps.casas.forms import CasaLegislativaForm
from sigi.apps.casas.models import CasaLegislativa, Presidente, Funcionario, TipoCasaLegislativa
from sigi.apps.casas.reports import CasasLegislativasLabels, CasasLegislativasReport
from sigi.apps.casas.views import report_complete, labels_report, export_csv, \
labels_report_sem_presidente, report, \
adicionar_casas_carrinho
from sigi.apps.utils import queryset_ascii
from sigi.apps.contatos.models import Telefone
from sigi.apps.convenios.models import Projeto, Convenio, EquipamentoPrevisto, Anexo
from sigi.apps.convenios.models import Convenio
from sigi.apps.mesas.models import Legislatura
from sigi.apps.diagnosticos.models import Diagnostico
from sigi.apps.inventario.models import Bem
from sigi.apps.servicos.models import Servico
from sigi.apps.metas.models import PlanoDiretor
from sigi.apps.ocorrencias.models import Ocorrencia
from django.utils.translation import ugettext as _
class TelefonesInline(generic.GenericTabularInline):
@ -28,6 +25,7 @@ class TelefonesInline(generic.GenericTabularInline):
readonly_fields = ('ult_alteracao',)
extra = 1
class PresidenteInline(admin.StackedInline):
model = Presidente
exclude = ['cargo','funcao']
@ -36,6 +34,7 @@ class PresidenteInline(admin.StackedInline):
max_num = 1
inlines = (TelefonesInline)
class FuncionariosInline(admin.StackedInline):
model = Funcionario
fieldsets = ((None, {
@ -47,6 +46,7 @@ class FuncionariosInline(admin.StackedInline):
def queryset(self, request):
return self.model.objects.exclude(cargo="Presidente")
class ConveniosInline(admin.StackedInline):
model = Convenio
fieldsets = (
@ -88,6 +88,7 @@ class ConveniosInline(admin.StackedInline):
link_convenio.short_description = 'Editar convenio'
link_convenio.allow_tags = True
class LegislaturaInline(admin.TabularInline):
model = Legislatura
fields = ['numero', 'data_inicio', 'data_fim', 'data_eleicao', 'total_parlamentares', 'link_parlamentares',]
@ -107,6 +108,7 @@ class LegislaturaInline(admin.TabularInline):
link_parlamentares.short_description = 'Parlamentares'
link_parlamentares.allow_tags = True
class DiagnosticoInline(admin.TabularInline):
model = Diagnostico
fields = ['data_visita_inicio', 'data_visita_fim', 'publicado', 'data_publicacao', 'responsavel', 'link_diagnostico',]
@ -128,9 +130,11 @@ class DiagnosticoInline(admin.TabularInline):
link_diagnostico.short_description = 'Ver PDF'
link_diagnostico.allow_tags = True
class BemInline(admin.TabularInline):
model = Bem
class ServicoInline(admin.TabularInline):
model = Servico
fields = ['url', 'contato_tecnico', 'contato_administrativo', 'hospedagem_interlegis', 'data_ativacao', 'data_alteracao', 'data_desativacao']
@ -139,9 +143,11 @@ class ServicoInline(admin.TabularInline):
max_num = 0
can_delete = False
class PlanoDiretorInline(admin.TabularInline):
model = PlanoDiretor
class OcorrenciaInline(admin.TabularInline):
model = Ocorrencia
fields = ('data_criacao', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',)
@ -150,6 +156,7 @@ class OcorrenciaInline(admin.TabularInline):
max_num = 0
can_delete = False
class CasaLegislativaAdmin(admin.ModelAdmin):
form = CasaLegislativaForm
change_form_template = 'casas/change_form.html'
@ -164,7 +171,7 @@ class CasaLegislativaAdmin(admin.ModelAdmin):
queyrset = queryset_ascii
fieldsets = (
(None, {
'fields': ('tipo', 'nome', 'cnpj', 'num_parlamentares')
'fields': ('tipo', 'nome', 'cnpj', 'num_parlamentares', 'gerente_contas')
}),
('Endereço', {
'fields': ('data_instalacao', 'logradouro', 'bairro',

14
sigi/apps/casas/models.py

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.contenttypes import generic
from sigi.apps.parlamentares.models import Parlamentar
from sigi.apps.utils import SearchField
from datetime import datetime
import random
from unicodedata import normalize
from sigi.apps.contatos.models import Municipio
from datetime import datetime
from django.db import models
from django.contrib.contenttypes import generic
from sigi.apps.utils import SearchField
from sigi.apps.servidores.models import Servidor
class TipoCasaLegislativa(models.Model):
""" Modelo para representar o tipo da Casa Legislativa
@ -44,6 +44,8 @@ class CasaLegislativa(models.Model):
codigo_interlegis = models.CharField('Código Interlegis', max_length=3, blank=True)
# codigo_interlegis.ts_filter = True
gerente_contas = models.ForeignKey(Servidor, verbose_name="Gerente de contas")
# Informações de contato
logradouro = models.CharField(
max_length=100,

Loading…
Cancel
Save