Skip to content

Commit

Permalink
Atualização de 04/12/2020
Browse files Browse the repository at this point in the history
-> modified:   docs/instalacao.rst
-> new file:   saap/cerimonial/migrations/0079_auto_20201203_1919.py
-> new file:   saap/cerimonial/migrations/0080_auto_20201203_1926.py
-> modified:   saap/cerimonial/models.py
-> new file:   saap/core/migrations/0026_auto_20201203_1919.py
-> new file:   saap/core/migrations/0027_auto_20201203_1926.py
Correção do banco para não ter município/estado default. Isso causava problemas na instalação nova.
  • Loading branch information
ojonathacardoso committed Dec 4, 2020
1 parent b1246f1 commit 6009767
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/instalacao.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Instalação do Ambiente de Desenvolvimento

Procedimento testado no ``Debian Buster x64`` e ``Ubuntu 18.04 Bionic Beaver x64``. Além disto, quando do desenvolvimento em 2018, o SO utilizado o ``Debian Jessie x64``.

Para a instalação, foi utilizado o usuário de sistema ``saap``, que deve ter as devidas permissões para instalação e configuração.
Você pode escolher qualquer usuário de sistema para esse processo - todas as referências para ``$USER`` devem ser substituídas por esse usuário. O mesmo deve ter as devidas permissões para instalação e configuração.

1) Instalar dependências do sistema
----------------------------------------------------------------------------------------
Expand All @@ -20,7 +20,7 @@ Instale os pacotes:
::

sudo apt-get install -y git python3-dev libpq-dev graphviz-dev graphviz \
pkg-config postgresql postgresql-contrib pgadmin3 python-psycopg2 \
pkg-config postgresql postgresql-contrib pgadmin3 python3-psycopg2 \
software-properties-common build-essential libxml2-dev libjpeg-dev \
libssl-dev libffi-dev libxslt1-dev python3-setuptools \
python3-pip poppler-utils antiword default-jre python3-venv \
Expand All @@ -38,7 +38,7 @@ Instale o Node.js e o Bower

::

sudo npm install -g bower
sudo npm install bower -g

2) Instalar o virtualenv usando Python 3 para o projeto
-----------------------------------------------------
Expand Down
27 changes: 27 additions & 0 deletions saap/cerimonial/migrations/0079_auto_20201203_1919.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-12-03 22:19
from __future__ import unicode_literals

from django.db import migrations
import django.db.models.deletion
import smart_selects.db_fields


class Migration(migrations.Migration):

dependencies = [
('cerimonial', '0078_auto_20200915_1336'),
]

operations = [
migrations.AlterField(
model_name='endereco',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', default=4891, on_delete=django.db.models.deletion.CASCADE, related_name='endereco_set', to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='localtrabalho',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='estado', chained_model_field='estado', default=4891, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
]
42 changes: 42 additions & 0 deletions saap/cerimonial/migrations/0080_auto_20201203_1926.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-12-03 22:26
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields


class Migration(migrations.Migration):

dependencies = [
('cerimonial', '0079_auto_20201203_1919'),
]

operations = [
migrations.AlterField(
model_name='contato',
name='estado',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='contato_set', to='core.Estado', verbose_name='Estado de nascimento'),
),
migrations.AlterField(
model_name='endereco',
name='estado',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='endereco_set', to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='endereco',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', on_delete=django.db.models.deletion.CASCADE, related_name='endereco_set', to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='localtrabalho',
name='estado',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='localtrabalho_set', to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='localtrabalho',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='estado', chained_model_field='estado', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
]
6 changes: 1 addition & 5 deletions saap/cerimonial/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.db.models.deletion import SET_NULL, PROTECT, CASCADE
from django.utils.translation import ugettext_lazy as _

from saap import settings
from saap.core.models import Municipio, Estado, Partido
from saap.core.models import Trecho, Distrito, RegiaoMunicipal,\
SaapAuditoriaModelMixin, SaapSearchMixin, AreaTrabalho, Bairro
Expand Down Expand Up @@ -249,7 +248,6 @@ class Contato(SaapSearchMixin, SaapAuditoriaModelMixin):
estado = models.ForeignKey(
Estado,
blank=True, null=True,
default=Estado.objects.get(sigla=settings.DADOS_UF).pk,
related_name='contato_set',
verbose_name=_('Estado de nascimento'))

Expand Down Expand Up @@ -583,8 +581,7 @@ class LocalTrabalho(SaapAuditoriaModelMixin):
Estado,
verbose_name=_('Estado'),
related_name='localtrabalho_set',
blank=True, null=True,
default=Estado.objects.get(sigla=settings.DADOS_UF).pk)
blank=True, null=True)

municipio = ChainedForeignKey(
Municipio,
Expand Down Expand Up @@ -702,7 +699,6 @@ class Endereco(SaapAuditoriaModelMixin):
estado = models.ForeignKey(
Estado,
verbose_name=_('Estado'),
default=Estado.objects.get(sigla=settings.DADOS_UF).pk,
related_name='endereco_set',
blank=False, null=False)

Expand Down
52 changes: 52 additions & 0 deletions saap/core/migrations/0026_auto_20201203_1919.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-12-03 22:19
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields


class Migration(migrations.Migration):

dependencies = [
('core', '0025_auto_20201105_1757'),
]

operations = [
migrations.AlterField(
model_name='bairro',
name='estado',
field=models.ForeignKey(default=21, on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='bairro',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', default=4891, on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='distrito',
name='estado',
field=models.ForeignKey(default=21, on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='distrito',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', default=4891, on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='municipio',
name='estado',
field=models.ForeignKey(default=21, on_delete=django.db.models.deletion.CASCADE, related_name='municipios_set', to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='regiaomunicipal',
name='estado',
field=models.ForeignKey(default=21, on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='regiaomunicipal',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', default=4891, on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
]
52 changes: 52 additions & 0 deletions saap/core/migrations/0027_auto_20201203_1926.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-12-03 22:26
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields


class Migration(migrations.Migration):

dependencies = [
('core', '0026_auto_20201203_1919'),
]

operations = [
migrations.AlterField(
model_name='bairro',
name='estado',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='bairro',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='distrito',
name='estado',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='distrito',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
migrations.AlterField(
model_name='municipio',
name='estado',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='municipios_set', to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='regiaomunicipal',
name='estado',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='regiaomunicipal',
name='municipio',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='estado', chained_model_field='estado', on_delete=django.db.models.deletion.CASCADE, to='core.Municipio', verbose_name='Município'),
),
]

0 comments on commit 6009767

Please sign in to comment.