diff --git a/.gitignore b/.gitignore index 40668f0..c3126c1 100644 --- a/.gitignore +++ b/.gitignore @@ -100,7 +100,6 @@ whoosh_index/ *.pyc .gitignore -saap/templates/novidades.html gunicorn_conf gunicorn_start.sh brasao-camara.png diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 459600d..094c130 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -18,7 +18,7 @@ services: networks: - saap-net saap: - image: interlegis/saap:latest + image: interlegis/saap:latest # build: # context: . # dockerfile: Dockerfile @@ -28,7 +28,7 @@ services: restart: always environment: SITE_NAME: 'Sistema de Apoio à Atividade Parlamentar' - SITE_DOMAIN: 'saap.camaranh.rs.gov.br' + SITE_DOMAIN: 'saap-demo.camaranh.rs.gov.br' DEBUG: 'False' DJANGO_TOOLBAR: 'False' EMAIL_USE_TLS: 'True' diff --git a/docker/docker.sh b/docker/docker.sh new file mode 100755 index 0000000..ce93cad --- /dev/null +++ b/docker/docker.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +LATEST_VERSION=3.1.0 +REPOSITORY="interlegis" + +docker build --no-cache -t $REPOSITORY/saap:$LATEST_VERSION . + +docker tag $REPOSITORY/saap:$LATEST_VERSION $REPOSITORY/saap:latest + +docker push $REPOSITORY/saap:$LATEST_VERSION +docker push $REPOSITORY/saap:latest diff --git a/docker/start.sh b/docker/start.sh index 777b6ac..b458c9e 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -52,10 +52,6 @@ load_db() { export PGPASSWORD="saap" - echo "[LOAD_DB] Creating postgres role..." - psql -U saap -c "CREATE ROLE postgres LOGIN ENCRYPTED PASSWORD 'postgres' SUPERUSER INHERIT CREATEDB NOCREATEROLE NOREPLICATION;" - psql -U saap -c "ALTER ROLE postgres VALID UNTIL 'infinity';" - echo "[LOAD_DB] Creating database structure..." yes yes | python3 manage.py migrate diff --git a/docs/docker.rst b/docs/docker.rst index f9c54f0..b232d01 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -82,7 +82,7 @@ Para interromper a execução das imagens rodando em background, basta rodar: sudo docker-compose stop -Backup e restauração do banco +Backup do banco Postgres ---------------------------------------------------------------------------------------- Para realizar o backup do banco do SAAP, basta rodar o seguinte comando: @@ -93,12 +93,17 @@ Para realizar o backup do banco do SAAP, basta rodar o seguinte comando: O destino e o nome do arquivo gerado são personalizáveis. -Para realizar a restauraçao do banco, é necessário previamente excluir o banco atual, para, então, fazer o processo: +Restore do banco Postgres +---------------------------------------------------------------------------------------- + +Para realizar a restauraçao do banco, é necessário previamente limpar o banco atual: :: - docker exec postgres psql -U postgres -c 'DROP DATABASE saap' - docker exec postgres psql -U postgres -c "CREATE DATABASE saap ENCODING 'UTF8' template template0" + docker exec postgres psql -U saap -c 'DROP SCHEMA PUBLIC CASCADE;' + docker exec postgres psql -U saap -c 'CREATE SCHEMA PUBLIC;' + +Em seguida, basta copiar o arquivo para dentro da imagem e fazer a importação: :: diff --git a/manage.py b/manage.py index 1cfa2bd..dfb8439 100755 --- a/manage.py +++ b/manage.py @@ -1,4 +1,5 @@ #!/usr/bin/env python + import os import sys diff --git a/release.sh b/release.sh index f060f42..87a4325 100755 --- a/release.sh +++ b/release.sh @@ -30,8 +30,6 @@ function change_files { echo "Atualizando de "$LATEST_VERSION" para "$NEXT_VERSION"..." - sed -E -i "s|$LATEST_VERSION|$NEXT_VERSION|g" saap/templates/base.html - sed -E -i "s|$LATEST_VERSION|$NEXT_VERSION|g" saap/settings.py } @@ -53,6 +51,5 @@ function commit_and_push { echo "Concluído" } -update_repo change_files commit_and_push diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 829fa6e..04f14a9 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -6,7 +6,7 @@ django-braces==1.8.1 django-compressor==2.0 django-crispy-forms==1.6.0 django-debug-toolbar==1.5 -django-easy-audit==1.2.3 +django-easy-audit==1.0 django-exclusivebooleanfield django-extensions==1.6.1 django-extra-views==0.7.1 diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index c0354ee..0000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.5.2 diff --git a/saap/core/urls.py b/saap/core/urls.py index aeb0094..d3358fe 100644 --- a/saap/core/urls.py +++ b/saap/core/urls.py @@ -7,7 +7,7 @@ from saap.core.forms import LoginForm, NewPasswordForm, ResetPasswordForm, PasswordForm from saap.core.views import CepCrud, RegiaoMunicipalCrud, DistritoCrud,\ BairroCrud, MunicipioCrud, EstadoCrud, TipoLogradouroCrud, LogradouroCrud, TrechoCrud, \ - TrechoJsonSearchView, TrechoJsonView, AreaTrabalhoCrud, \ + TrechoJsonSearchView, TrechoJsonView, AreaTrabalhoCrud, ParlamentarCrud, \ OperadorAreaTrabalhoCrud, PartidoCrud, ImpressoEnderecamentoCrud, HelpTopicView, UserCrud from .apps import AppConfig @@ -84,6 +84,7 @@ include(ImpressoEnderecamentoCrud.get_urls())), url(r'^sistema/core/partido/', include(PartidoCrud.get_urls())), + url(r'^sistema/core/parlamentar/', include(ParlamentarCrud.get_urls())), url(r'^tabelas$', permission_required( 'core.menu_tabelas_auxiliares', login_url='saap.core:login')( diff --git a/saap/core/views.py b/saap/core/views.py index 4a2cf49..602bb1e 100644 --- a/saap/core/views.py +++ b/saap/core/views.py @@ -22,7 +22,7 @@ ListWithSearchForm, UserForm from saap.core.models import Cep, TipoLogradouro, Logradouro, RegiaoMunicipal,\ Distrito, Bairro, Municipio, Estado, Trecho, AreaTrabalho, OperadorAreaTrabalho,\ - ImpressoEnderecamento, User + ImpressoEnderecamento, User, Parlamentar from saap.core.rules import rules_patterns from saap.core.serializers import TrechoSearchSerializer, TrechoSerializer from saap.globalrules import globalrules @@ -42,6 +42,7 @@ BairroCrud = DetailMasterCrud.build(Bairro, None, 'bairro') TipoLogradouroCrud = DetailMasterCrud.build(TipoLogradouro, None, 'tipo_logradouro') LogradouroCrud = DetailMasterCrud.build(Logradouro, None, 'logradouro') +ParlamentarCrud = DetailMasterCrud.build(Parlamentar, None, 'parlamentar') #UserCrud = DetailMasterCrud.build(User, None, 'usuario') diff --git a/saap/settings.py b/saap/settings.py index b8e5c6c..9e0dda6 100644 --- a/saap/settings.py +++ b/saap/settings.py @@ -57,7 +57,7 @@ DADOS_SITE = config('DADOS_SITE'); BRASAO_PROPRIO = config('BRASAO_PROPRIO'); -VERSION='3.1.0' +VERSION='3.1.1' INSTALLED_APPS = ( #'django_admin_bootstrapped', diff --git a/saap/templates/base.html b/saap/templates/base.html index 4bc7303..261237c 100644 --- a/saap/templates/base.html +++ b/saap/templates/base.html @@ -47,11 +47,9 @@ {{ user.get_full_name|default:user.email }} {% block base_workspace %} - {% if user and not user.is_anonymous %} {% for at in areatrabalho %}
{{at.nome}} {% endfor %} - {% endif %} {% endblock base_workspace %} @@ -75,6 +73,7 @@
  • {% trans "Início" %}
  • + {% if user and not user.is_anonymous %} {% if perms.core.menu_contatos %} {% endif %} + {% endif %} diff --git a/saap/templates/core/layouts.yaml b/saap/templates/core/layouts.yaml index 548cae5..993ea1d 100644 --- a/saap/templates/core/layouts.yaml +++ b/saap/templates/core/layouts.yaml @@ -72,3 +72,8 @@ User: {% trans 'Usuário' %}: - first_name last_name email:6 - groups is_active:3 is_staff:3 + +Parlamentar: + {% trans 'Parlamentar' %}: + - nome_completo nome_parlamentar + - ativo sexo data_nascimento diff --git a/saap/templates/core/login.html b/saap/templates/core/login.html index de9d643..dc30331 100644 --- a/saap/templates/core/login.html +++ b/saap/templates/core/login.html @@ -29,7 +29,7 @@

    Entrar

    {% if form.errors %} -
    Usuário e/o senha inválidos +
    Usuário e/ou senha inválidos
    {% endif %} diff --git a/saap/templates/saap_sistema.html b/saap/templates/saap_sistema.html index 9a864b0..3a3aa8a 100644 --- a/saap/templates/saap_sistema.html +++ b/saap/templates/saap_sistema.html @@ -44,8 +44,9 @@

    Módulo de Relatórios


    -

    Outros

    +

    Configurações de Parlamentares

    diff --git a/sync.sh b/sync.sh index e5f3ca4..09aee69 100755 --- a/sync.sh +++ b/sync.sh @@ -1,7 +1,14 @@ -#/bin/bash +#!/usr/bin/env bash -git fetch upstream -git checkout master -git merge upstream/master -git push origin master -git push --tags +function update_repo { + + echo "Sincronizando e atualizando repositório local..." + + git fetch upstream + git checkout master + git merge upstream/master + + echo "Repositório sincronizado" +} + +update_repo