Browse Source

Fixes #55

pull/66/head
Sesostris Vieira 4 years ago
parent
commit
18a050df88
  1. 11
      sigi/apps/servidores/admin.py
  2. 32
      sigi/apps/servidores/migrations/0007_auto_20210430_0735.py
  3. 6
      sigi/apps/servidores/models.py

11
sigi/apps/servidores/admin.py

@ -45,12 +45,19 @@ class ServicoAdmin(admin.ModelAdmin):
class ServidorAdmin(BaseModelAdmin): class ServidorAdmin(BaseModelAdmin):
list_display = ('imagem_foto', 'nome_completo', 'is_active', 'servico', ) list_display = ('imagem_foto', 'nome_completo', 'is_active', 'servico', )
list_display_links = ('imagem_foto', 'nome_completo',) list_display_links = ('imagem_foto', 'nome_completo',)
list_filter = ('user__is_active', 'servico',) list_filter = ('user__is_active', 'externo', 'servico')
search_fields = ('nome_completo', 'user__email', 'user__first_name', search_fields = ('nome_completo', 'user__email', 'user__first_name',
'user__last_name', 'user__username', 'servico__nome', 'user__last_name', 'user__username', 'servico__nome',
'servico__sigla') 'servico__sigla')
raw_id_fields = ('user',) raw_id_fields = ('user',)
fields = ['user', 'nome_completo', 'foto', 'servico',] fieldsets = (
(None, {
'fields': ('user', 'nome_completo', 'foto', 'servico',)
}),
(_(u"outros órgãos"), {
'fields': ('externo', 'orgao_origem', 'qualificacoes'),
}),
)
def lookup_allowed(self, lookup, value): def lookup_allowed(self, lookup, value):
return super(ServidorAdmin, self).lookup_allowed(lookup, value) or \ return super(ServidorAdmin, self).lookup_allowed(lookup, value) or \

32
sigi/apps/servidores/migrations/0007_auto_20210430_0735.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('servidores', '0006_auto_20210429_0822'),
]
operations = [
migrations.AddField(
model_name='servidor',
name='externo',
field=models.BooleanField(default=False, verbose_name='colaborador externo'),
preserve_default=True,
),
migrations.AddField(
model_name='servidor',
name='orgao_origem',
field=models.CharField(max_length=100, verbose_name='\xf3rg\xe3o de origem, ', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='servidor',
name='qualificacoes',
field=models.TextField(verbose_name='qualifica\xe7\xf5es', blank=True),
preserve_default=True,
),
]

6
sigi/apps/servidores/models.py

@ -54,6 +54,12 @@ class Servidor(models.Model):
blank=True, blank=True,
null=True null=True
) )
externo = models.BooleanField(_(u"colaborador externo"), default=False)
orgao_origem = models.CharField(
_(u"órgão de origem, "),
max_length=100, blank=True
)
qualificacoes = models.TextField(_(u"qualificações"), blank=True)
class Meta: class Meta:
ordering = ('nome_completo',) ordering = ('nome_completo',)

Loading…
Cancel
Save