Skip to content

Commit

Permalink
Merge pull request #74 from ojonathacardoso/master
Browse files Browse the repository at this point in the history
Release: 3.1.1
  • Loading branch information
ojonathacardoso authored May 22, 2022
2 parents 427cebc + 7ce7d63 commit 5d3ecab
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 29 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ whoosh_index/

*.pyc
.gitignore
saap/templates/novidades.html
gunicorn_conf
gunicorn_start.sh
brasao-camara.png
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
networks:
- saap-net
saap:
image: interlegis/saap:latest
image: interlegis/saap:latest
# build:
# context: .
# dockerfile: Dockerfile
Expand All @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions docker/docker.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 9 additions & 4 deletions docs/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:

::

Expand Down
1 change: 1 addition & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python

import os
import sys

Expand Down
3 changes: 0 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -53,6 +51,5 @@ function commit_and_push {
echo "Concluído"
}

update_repo
change_files
commit_and_push
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

3 changes: 2 additions & 1 deletion saap/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')(
Expand Down
3 changes: 2 additions & 1 deletion saap/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion saap/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions saap/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<br><small> {{at.nome}}</small>
{% endfor %}
{% endif %}
{% endblock base_workspace %}

<span class="caret"></span>
Expand All @@ -75,6 +73,7 @@

<li><a href="/">{% trans "Início" %}</a></li>

{% if user and not user.is_anonymous %}
{% if perms.core.menu_contatos %}
<li class="dropdown">
<a href="#fakeLink" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">{% trans "Contatos" %}<span class="caret"></span></a>
Expand Down Expand Up @@ -130,6 +129,7 @@
</li>
{% endif %}

{% endif %}
</ul>


Expand Down
5 changes: 5 additions & 0 deletions saap/templates/core/layouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion saap/templates/core/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3 class="panel-title"><center>Entrar</center></h3>
<div class="panel-body">
<form id="login-form" method="post" action="{% url 'saap.core:login' %}">
{% if form.errors %}
<div class="alert alert-danger">Usuário e/o senha inválidos
<div class="alert alert-danger">Usuário e/ou senha inválidos
</div>
{% endif %}

Expand Down
3 changes: 2 additions & 1 deletion saap/templates/saap_sistema.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ <h2>Módulo de Relatórios</h2>
<div class="col-md-6"><a href="{% url 'saap.core:impressoenderecamento_list' %}" class="btn btn-link">Impressos de endereçamento</a></div>
</div>
<hr>
<h2>Outros</h2>
<h2>Configurações de Parlamentares</h2>
<div class="row">
<div class="col-md-6"><a href="{% url 'saap.core:parlamentar_list' %}" class="btn btn-link">Parlamentares</a></div>
<div class="col-md-6"><a href="{% url 'saap.core:partido_list' %}" class="btn btn-link">Partidos políticos</a></div>
</div>

Expand Down
19 changes: 13 additions & 6 deletions sync.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5d3ecab

Please sign in to comment.