From 83674af34c3f551fffc1c3cd7ae6b072ce6bcc37 Mon Sep 17 00:00:00 2001 From: "Camilo Carlos (Estagiario)" Date: Fri, 7 May 2010 15:50:57 +0000 Subject: [PATCH] =?UTF-8?q?Altera=C3=A7=C3=A3o=20de=20alguns=20models?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/casas/admin.py | 7 ++++++- sigi/apps/convenios/admin.py | 2 +- sigi/apps/convenios/models.py | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 6d73979..8e90087 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -4,6 +4,7 @@ from django.contrib.contenttypes import generic from sigi.apps.casas.forms import CasaLegislativaForm from sigi.apps.casas.models import CasaLegislativa from sigi.apps.contatos.models import Contato, Telefone +from sigi.apps.convenios.models import Convenio, EquipamentoPrevisto, Anexo class ContatosInline(generic.GenericTabularInline): model = Contato @@ -14,11 +15,15 @@ class TelefonesInline(generic.GenericTabularInline): model = Telefone extra = 2 +class ConveniosInline(admin.TabularInline): + model = Convenio + extra =0 + class CasaLegislativaAdmin(admin.ModelAdmin): form = CasaLegislativaForm change_form_template = 'casas/change_form.html' change_list_template = 'casas/change_list.html' - inlines = (TelefonesInline, ContatosInline) + inlines = (TelefonesInline, ContatosInline, ConveniosInline) list_display = ('nome', 'email', 'pagina_web', 'municipio') list_display_links = ('nome',) list_filter = ('tipo', 'municipio') diff --git a/sigi/apps/convenios/admin.py b/sigi/apps/convenios/admin.py index a4fe994..c832fa3 100644 --- a/sigi/apps/convenios/admin.py +++ b/sigi/apps/convenios/admin.py @@ -25,7 +25,7 @@ class ConvenioAdmin(admin.ModelAdmin): change_list_template = 'convenios/change_list.html' fieldsets = ( (None, - {'fields': ('casa_legislativa', 'num_processo_sf')} + {'fields': ('casa_legislativa', 'num_processo_sf','tipo_convenio')} ), ('Datas', {'fields': ('data_adesao', 'data_retorno_assinatura', diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index dc928c6..ce886ee 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -1,9 +1,15 @@ # -*- coding: utf-8 -*- from datetime import datetime from django.db import models +#from django.contrib.contenttypes import ContentType from django.contrib.contenttypes import generic class Convenio(models.Model): + CONVENIO_TIPO = ( + ('PI', 'Programa Interlegis'), + ('PPL', 'Projeto Piloto de Modernização'), + ('PML', 'Projeto Modernização Legislaivo') + ) casa_legislativa = models.ForeignKey( 'casas.CasaLegislativa', verbose_name='Casa Legislativa' @@ -19,6 +25,10 @@ class Convenio(models.Model): null=True, blank=True, ) + tipo_convenio = models.CharField( + max_length=10, + choices=CONVENIO_TIPO + ) data_retorno_assinatura = models.DateField( 'data do retorno e assinatura', null=True, @@ -47,6 +57,7 @@ class Convenio(models.Model): null=True, blank=True, ) + #content_type = models.ForeignKey(ContentType) class Meta: get_latest_by = 'id'