|
@ -2,8 +2,8 @@ |
|
|
from django.contrib import admin |
|
|
from django.contrib import admin |
|
|
from django.contrib.contenttypes import generic |
|
|
from django.contrib.contenttypes import generic |
|
|
from sigi.apps.casas.forms import CasaLegislativaForm |
|
|
from sigi.apps.casas.forms import CasaLegislativaForm |
|
|
from sigi.apps.casas.models import CasaLegislativa |
|
|
from sigi.apps.casas.models import CasaLegislativa, Presidente, Funcionario |
|
|
from sigi.apps.contatos.models import Contato, Telefone |
|
|
from sigi.apps.contatos.models import Telefone |
|
|
from sigi.apps.convenios.models import Projeto, Convenio, EquipamentoPrevisto, Anexo |
|
|
from sigi.apps.convenios.models import Projeto, Convenio, EquipamentoPrevisto, Anexo |
|
|
from django.http import HttpResponse, HttpResponseRedirect |
|
|
from django.http import HttpResponse, HttpResponseRedirect |
|
|
from sigi.apps.casas.reports import CasasLegislativasLabels, CasasLegislativasReport |
|
|
from sigi.apps.casas.reports import CasasLegislativasLabels, CasasLegislativasReport |
|
@ -13,14 +13,21 @@ from sigi.apps.casas.views import report_complete, labels_report, export_csv, \ |
|
|
adicionar_casas_carrinho |
|
|
adicionar_casas_carrinho |
|
|
from sigi.apps.utils import queryset_ascii |
|
|
from sigi.apps.utils import queryset_ascii |
|
|
|
|
|
|
|
|
class ContatosInline(generic.GenericTabularInline): |
|
|
|
|
|
model = Contato |
|
|
|
|
|
extra = 2 |
|
|
|
|
|
raw_id_fields = ('municipio',) |
|
|
|
|
|
|
|
|
|
|
|
class TelefonesInline(generic.GenericTabularInline): |
|
|
class TelefonesInline(generic.GenericTabularInline): |
|
|
model = Telefone |
|
|
model = Telefone |
|
|
extra = 2 |
|
|
extra = 1 |
|
|
|
|
|
|
|
|
|
|
|
class PresidenteInline(admin.StackedInline): |
|
|
|
|
|
model = Presidente |
|
|
|
|
|
exclude = ['cargo','funcao'] |
|
|
|
|
|
extra = 1 |
|
|
|
|
|
max_num = 1 |
|
|
|
|
|
inlines = (TelefonesInline) |
|
|
|
|
|
|
|
|
|
|
|
class FuncionariosInline(admin.StackedInline): |
|
|
|
|
|
model = Funcionario |
|
|
|
|
|
extra = 1 |
|
|
|
|
|
inlines = (TelefonesInline) |
|
|
|
|
|
|
|
|
class ConveniosInline(admin.TabularInline): |
|
|
class ConveniosInline(admin.TabularInline): |
|
|
model = Convenio |
|
|
model = Convenio |
|
@ -32,16 +39,15 @@ class CasaLegislativaAdmin(admin.ModelAdmin): |
|
|
change_form_template = 'casas/change_form.html' |
|
|
change_form_template = 'casas/change_form.html' |
|
|
change_list_template = 'casas/change_list.html' |
|
|
change_list_template = 'casas/change_list.html' |
|
|
actions = ['adicionar_casas',] |
|
|
actions = ['adicionar_casas',] |
|
|
inlines = (TelefonesInline, ContatosInline, ConveniosInline) |
|
|
inlines = (TelefonesInline, PresidenteInline, FuncionariosInline, ConveniosInline) |
|
|
list_display = ('nome','municipio','presidente','logradouro') |
|
|
list_display = ('nome','municipio','logradouro') |
|
|
list_display_links = ('nome',) |
|
|
list_display_links = ('nome',) |
|
|
list_filter = ('tipo', 'municipio') |
|
|
list_filter = ('tipo', 'municipio') |
|
|
ordering = ('nome','municipio__uf') |
|
|
ordering = ('nome','municipio__uf') |
|
|
queyrset = queryset_ascii |
|
|
queyrset = queryset_ascii |
|
|
fieldsets = ( |
|
|
fieldsets = ( |
|
|
(None, { |
|
|
(None, { |
|
|
'fields': ('tipo', 'nome', 'telefone', 'cnpj', |
|
|
'fields': ('tipo', 'nome', 'cnpj',) |
|
|
'presidente'), |
|
|
|
|
|
}), |
|
|
}), |
|
|
('Endereço', { |
|
|
('Endereço', { |
|
|
'fields': ('logradouro', 'bairro', 'municipio', 'cep', 'pagina_web','email'), |
|
|
'fields': ('logradouro', 'bairro', 'municipio', 'cep', 'pagina_web','email'), |
|
|