Browse Source

Transforma casa legislativa de usuário em uma chave estrageira

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
43c3c197ce
  1. 1
      requirements/dev-requirements.txt
  2. 12
      sigi/apps/templates/index.html
  3. 31
      sigi/apps/usuarios/migrations/0005_auto_20160624_0853.py
  4. 40
      sigi/apps/usuarios/models.py

1
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

12
sigi/apps/templates/index.html

@ -1,12 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}
<h1 class="page-header">Bem-vindo ao Centro de Suporte</h1>
{% 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 %}

31
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'),
),
]

40
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')

Loading…
Cancel
Save