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

14
sigi/apps/casas/models.py

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*- # -*- 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 import random
from unicodedata import normalize 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): class TipoCasaLegislativa(models.Model):
""" Modelo para representar o tipo da Casa Legislativa """ 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 = models.CharField('Código Interlegis', max_length=3, blank=True)
# codigo_interlegis.ts_filter = True # codigo_interlegis.ts_filter = True
gerente_contas = models.ForeignKey(Servidor, verbose_name="Gerente de contas")
# Informações de contato # Informações de contato
logradouro = models.CharField( logradouro = models.CharField(
max_length=100, max_length=100,

Loading…
Cancel
Save