Browse Source

Alteração de alguns models

0.3
Camilo Carlos (Estagiario) 15 years ago
parent
commit
83674af34c
  1. 7
      sigi/apps/casas/admin.py
  2. 2
      sigi/apps/convenios/admin.py
  3. 11
      sigi/apps/convenios/models.py

7
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.forms import CasaLegislativaForm
from sigi.apps.casas.models import CasaLegislativa from sigi.apps.casas.models import CasaLegislativa
from sigi.apps.contatos.models import Contato, Telefone from sigi.apps.contatos.models import Contato, Telefone
from sigi.apps.convenios.models import Convenio, EquipamentoPrevisto, Anexo
class ContatosInline(generic.GenericTabularInline): class ContatosInline(generic.GenericTabularInline):
model = Contato model = Contato
@ -14,11 +15,15 @@ class TelefonesInline(generic.GenericTabularInline):
model = Telefone model = Telefone
extra = 2 extra = 2
class ConveniosInline(admin.TabularInline):
model = Convenio
extra =0
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'
change_list_template = 'casas/change_list.html' change_list_template = 'casas/change_list.html'
inlines = (TelefonesInline, ContatosInline) inlines = (TelefonesInline, ContatosInline, ConveniosInline)
list_display = ('nome', 'email', 'pagina_web', 'municipio') list_display = ('nome', 'email', 'pagina_web', 'municipio')
list_display_links = ('nome',) list_display_links = ('nome',)
list_filter = ('tipo', 'municipio') list_filter = ('tipo', 'municipio')

2
sigi/apps/convenios/admin.py

@ -25,7 +25,7 @@ class ConvenioAdmin(admin.ModelAdmin):
change_list_template = 'convenios/change_list.html' change_list_template = 'convenios/change_list.html'
fieldsets = ( fieldsets = (
(None, (None,
{'fields': ('casa_legislativa', 'num_processo_sf')} {'fields': ('casa_legislativa', 'num_processo_sf','tipo_convenio')}
), ),
('Datas', ('Datas',
{'fields': ('data_adesao', 'data_retorno_assinatura', {'fields': ('data_adesao', 'data_retorno_assinatura',

11
sigi/apps/convenios/models.py

@ -1,9 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from datetime import datetime from datetime import datetime
from django.db import models from django.db import models
#from django.contrib.contenttypes import ContentType
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
class Convenio(models.Model): class Convenio(models.Model):
CONVENIO_TIPO = (
('PI', 'Programa Interlegis'),
('PPL', 'Projeto Piloto de Modernização'),
('PML', 'Projeto Modernização Legislaivo')
)
casa_legislativa = models.ForeignKey( casa_legislativa = models.ForeignKey(
'casas.CasaLegislativa', 'casas.CasaLegislativa',
verbose_name='Casa Legislativa' verbose_name='Casa Legislativa'
@ -19,6 +25,10 @@ class Convenio(models.Model):
null=True, null=True,
blank=True, blank=True,
) )
tipo_convenio = models.CharField(
max_length=10,
choices=CONVENIO_TIPO
)
data_retorno_assinatura = models.DateField( data_retorno_assinatura = models.DateField(
'data do retorno e assinatura', 'data do retorno e assinatura',
null=True, null=True,
@ -47,6 +57,7 @@ class Convenio(models.Model):
null=True, null=True,
blank=True, blank=True,
) )
#content_type = models.ForeignKey(ContentType)
class Meta: class Meta:
get_latest_by = 'id' get_latest_by = 'id'

Loading…
Cancel
Save