diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 1a43776..4377121 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -2,4 +2,5 @@ django-debug-toolbar==1.4 ipdb==0.10.0 ipython==4.2.0 +model_mommy==1.2.6 pygraphviz==1.3.1 diff --git a/sigi/apps/templates/index.html b/sigi/apps/templates/index.html deleted file mode 100644 index fb3a548..0000000 --- a/sigi/apps/templates/index.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %} -

Bem-vindo ao Centro de Suporte

-{% endblock %} - -{% block base_content %} - Através deste sistema, você poderá solicitar novos serviços a serem - hospedados em nosso Data Center e acompanhar as solicitações já em aberto. - Cadastre-se para continuar. -{% endblock %} diff --git a/sigi/apps/usuarios/migrations/0005_auto_20160624_0853.py b/sigi/apps/usuarios/migrations/0005_auto_20160624_0853.py new file mode 100644 index 0000000..8d6569c --- /dev/null +++ b/sigi/apps/usuarios/migrations/0005_auto_20160624_0853.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-24 08:53 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import sigi.apps.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('usuarios', '0004_auto_20160623_0829'), + ] + + operations = [ + migrations.DeleteModel( + name='CasaLegislativa', + ), + migrations.AddField( + model_name='usuario', + name='search_text', + field=sigi.apps.utils.SearchField(default='casa', editable=False, field_names=[b'casa_legislativa']), + preserve_default=False, + ), + migrations.AlterField( + model_name='usuario', + name='casa_legislativa', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='casas.CasaLegislativa', verbose_name='Casa Legislativa'), + ), + ] diff --git a/sigi/apps/usuarios/models.py b/sigi/apps/usuarios/models.py index fc31e81..b7efa7c 100644 --- a/sigi/apps/usuarios/models.py +++ b/sigi/apps/usuarios/models.py @@ -5,38 +5,15 @@ from django.contrib.auth.models import User from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ - +from sigi.apps.utils import SearchField from sigi.apps.crud.utils import UF, YES_NO_CHOICES -class CasaLegislativa(models.Model): - nome = models.CharField(max_length=100, verbose_name=_(u'Nome')) - sigla = models.CharField(max_length=100, verbose_name=_(u'Sigla')) - endereco = models.CharField(max_length=100, verbose_name=_(u'Endereço')) - cep = models.CharField(max_length=100, verbose_name=_(u'CEP')) - municipio = models.CharField(max_length=100, verbose_name=_(u'Município')) - uf = models.CharField(max_length=100, - choices=UF, - verbose_name=_(u'UF')) - telefone = models.CharField( - max_length=100, blank=True, verbose_name=_(u'Telefone')) - endereco_web = models.URLField( - max_length=100, blank=True, verbose_name=_(u'HomePage')) - email = models.EmailField( - max_length=100, blank=True, verbose_name=_(u'E-mail')) - - class Meta(object): - verbose_name = _(u'Casa Legislativa') - verbose_name_plural = _(u'Casas Legislativas') - - def __str__(self): - return u'[%s] %s' % (self.sigla, self.nome) - - class Subsecretaria(models.Model): nome = models.CharField(verbose_name=_(u'Nome'), max_length=100, null=True) - sigla = models.CharField(verbose_name=_(u'Sigla'), max_length=10, null=True) + sigla = models.CharField(verbose_name=_(u'Sigla'), + max_length=10, null=True) class Meta(object): ordering = (u'nome', u'sigla') @@ -131,15 +108,18 @@ class Usuario(models.Model): verbose_name=_(u'Vinculo'), choices=TIPO_VINCULO, default=u'--------') - casa_legislativa = models.CharField( - max_length=30, - verbose_name=_(u'Casa Legislativa'), - default=u'--------') primeiro_telefone = models.ForeignKey( Telefone, null=True, related_name=u'primeiro_telefone') segundo_telefone = models.ForeignKey( Telefone, null=True, related_name=u'segundo_telefone') + casa_legislativa = models.ForeignKey( + 'casas.CasaLegislativa', + verbose_name=_(u'Casa Legislativa') + ) + # campo de busca em caixa baixa e sem acentos + search_text = SearchField(field_names=['casa_legislativa']) + class Meta(object): verbose_name = _(u'Usuário') verbose_name_plural = _(u'Usuários')