diff --git a/.gitignore b/.gitignore index 38805b350..d66a04a22 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,8 @@ collected_static bower bower_components media +whoosh/ +solr-4.10.2/ +postgres-data/ +data/ +solr-*/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index bf5ee38fd..0e0a27ad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,3 +20,7 @@ script: - ./manage.py bower install - py.test --create-db # - ./test_and_check_qa.sh + +addons: + hosts: + - 127.0.0.1 sapldb diff --git a/Dockerfile b/Dockerfile index 9880dc4ef..838257c66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,53 +1,49 @@ -FROM ubuntu:15.04 - -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -RUN mkdir /sapl - -RUN echo "deb http://archive.ubuntu.com/ubuntu/ vivid universe" | tee -a "/etc/apt/sources.list" - -RUN \ - apt-get update && \ - apt-get install -y -f \ - software-properties-common \ - libpq-dev \ - graphviz-dev \ - graphviz \ - build-essential \ - git \ - pkg-config \ - python3-dev \ - libxml2-dev \ - libjpeg-dev \ - libssl-dev \ - libffi-dev \ - libxslt1-dev \ - python3-setuptools \ - curl - -# use python3 in pip -RUN easy_install3 pip lxml - -# install nodejs -RUN DEBIAN_FRONTEND=noninteractive curl -sL https://deb.nodesource.com/setup_5.x | bash - -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs - -# install bower -RUN npm install -g bower - -# Bower aceitar root -RUN touch /root/.bowerrc -RUN chmod 751 /root/.bowerrc -RUN echo "{ \"allow_root\": true }" >> /root/.bowerrc - -WORKDIR /sapl - -ADD . /sapl - -RUN pip install -r requirements/dev-requirements.txt -RUN pip install --upgrade setuptools - -# RUN python3 manage.py bower install +FROM alpine:3.5 + +ENV BUILD_PACKAGES postgresql-dev graphviz-dev graphviz build-base git pkgconfig \ +python3-dev libxml2-dev jpeg-dev libressl-dev libffi-dev libxslt-dev nodejs py3-lxml \ +py3-magic postgresql-client vim + +RUN apk add --no-cache python3 nginx && \ + python3 -m ensurepip && \ + rm -r /usr/lib/python*/ensurepip && \ + pip3 install --upgrade pip setuptools && \ + rm -r /root/.cache && \ + rm -f /etc/nginx/conf.d/* + +RUN mkdir -p /var/interlegis/sapl && \ + apk add --update --no-cache $BUILD_PACKAGES && \ + npm install -g bower && \ + npm cache clean + +WORKDIR /var/interlegis/sapl/ + +ADD . /var/interlegis/sapl/ + +COPY start.sh /var/interlegis/sapl/ +COPY config/nginx/sapl.conf /etc/nginx/conf.d +COPY config/nginx/nginx.conf /etc/nginx/nginx.conf + +RUN pip install -r /var/interlegis/sapl/requirements/dev-requirements.txt --upgrade setuptools && \ + rm -r /root/.cache && \ + rm -r /tmp/* + +COPY config/env_dockerfile /var/interlegis/sapl/sapl/.env + +# manage.py bower install bug: https://github.com/nvbn/django-bower/issues/51 + +# compilescss - Precompile all occurrences of your SASS/SCSS files for the whole project into css files + +RUN python3 manage.py bower_install -- --allow-root --no-input && \ + python3 manage.py compilescss && \ + python3 manage.py collectstatic --no-input && \ + rm -rf /var/interlegis/sapl/sapl/.env && \ + rm -rf /var/interlegis/sapl/sapl.db + +RUN chmod +x /var/interlegis/sapl/start.sh && \ + ln -sf /dev/stdout /var/log/nginx/access.log && \ + ln -sf /dev/stderr /var/log/nginx/error.log + +VOLUME ["/var/interlegis/sapl/data", "/var/interlegis/sapl/media"] + +CMD ["/var/interlegis/sapl/start.sh"] diff --git a/README.rst b/README.rst index 539934ce2..b149ad906 100644 --- a/README.rst +++ b/README.rst @@ -30,6 +30,11 @@ Instruções para Deploy `Deploy SAPL com Nginx + Gunicorn `_ +Instalação do Solr +====================== + `Instalação e configuração do Solr `_ + + Instruções para Tradução ======================== @@ -55,7 +60,6 @@ Logo dos Partidos `Logo dos Partidos `_ - Perguntas Frequentes =================================== `Perguntas Frequentes `_ diff --git a/sapl/api/migrations/__init__.py b/bug.txt similarity index 100% rename from sapl/api/migrations/__init__.py rename to bug.txt diff --git a/busy-wait.sh b/busy-wait.sh new file mode 100644 index 000000000..73fde5c6b --- /dev/null +++ b/busy-wait.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +while true; do + COUNT_PG=`psql $1 -c '\l \q' | grep sapl | wc -l` + if ! [ "$COUNT_PG" -eq "0" ]; then + break + fi + echo "Esperando Database Setup" + sleep 10 +done diff --git a/config/env-sample b/config/env-sample new file mode 100644 index 000000000..bde081a92 --- /dev/null +++ b/config/env-sample @@ -0,0 +1,8 @@ +DATABASE_URL = postgresql://postgres:@sapldb:/sapl +KEY +DEBUG = False +EMAIL_USE_TLS = True +EMAIL_PORT = 587 +EMAIL_HOST = '' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' diff --git a/config/env_dockerfile b/config/env_dockerfile new file mode 100644 index 000000000..c83fc88f1 --- /dev/null +++ b/config/env_dockerfile @@ -0,0 +1,8 @@ +DATABASE_URL = sqlite:///sapl.db +SECRET_KEY = 'Dockerfile_Key' +DEBUG = False +EMAIL_USE_TLS = True +EMAIL_PORT = 587 +EMAIL_HOST = '' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf new file mode 100644 index 000000000..cfea596f1 --- /dev/null +++ b/config/nginx/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile off; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/config/nginx/sapl.conf b/config/nginx/sapl.conf new file mode 100644 index 000000000..ef3dac421 --- /dev/null +++ b/config/nginx/sapl.conf @@ -0,0 +1,39 @@ +upstream sapl_server { + + server unix:/var/interlegis/sapl/run/gunicorn.sock fail_timeout=0; + +} + +server { + + listen 80; + server_name sapl.test; + + client_max_body_size 4G; + + location /static/ { + alias /var/interlegis/sapl/collected_static/; + } + + location /media/ { + alias /var/interlegis/sapl/media/; + } + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_set_header Host $http_host; + + proxy_redirect off; + + + if (!-f $request_filename) { + proxy_pass http://sapl_server; + break; + } + } + error_page 500 502 503 504 /500.html; + location = /500.html { + root /var/interlegis/sapl/sapl/static/; + } +} diff --git a/create_admin.py b/create_admin.py new file mode 100644 index 000000000..7fe03a65c --- /dev/null +++ b/create_admin.py @@ -0,0 +1,33 @@ +import sys +import os +import django + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sapl.settings") +django.setup() + +from django.contrib.auth.models import User + +def create_superuser(): + username = "admin" + password = os.environ['ADMIN_PASSWORD'] if 'ADMIN_PASSWORD' in os.environ else None + email = os.environ['ADMIN_EMAIL'] if 'ADMIN_EMAIL' in os.environ else '' + + if User.objects.filter(username=username).exists(): + print("[SUPERUSER] User %s already exists. Exiting without change." % username) + sys.exit('ADMIN_USER_EXISTS') + else: + if not password: + print("[SUPERUSER] Environment variable $ADMIN_PASSWORD for user %s was not set. Leaving..." % username) + sys.exit('MISSING_ADMIN_PASSWORD') + + print("[SUPERUSER] Creating superuser...") + + u = User.objects.create_superuser(username=username, password=password, email=email) + u.save() + + print("[SUPERUSER] Done.") + + sys.exit(0) + +if __name__ == '__main__': + create_superuser() diff --git a/docker-compose.yml b/docker-compose.yml index 06c9d2cec..4fbbd4bea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,20 @@ -localhost: +sapldb: image: postgres environment: POSTGRES_PASSWORD: sapl POSTGRES_USER: sapl POSTGRES_DB: sapl + PGDATA : /var/lib/postgresql/data/ + volumes: + - sapldb_data:/var/lib/postgresql/data/ ports: - "5532:5432" -web: - build: . - command: bash -c "python3 manage.py bower install && python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000" +sapl: + image: interlegis/sapl:3.1.2-BETA volumes: - - .:/sapl - ports: - - "8000:8000" + - sapl_data:/var/interlegis/sapl/data + - sapl_media:/var/interlegis/sapl/media links: - - localhost + - sapldb + ports: + - "80:80" diff --git a/docker-env.sh b/docker-env.sh new file mode 100644 index 000000000..07528b0f1 --- /dev/null +++ b/docker-env.sh @@ -0,0 +1,6 @@ +#/bin/bash + +KEY=`python gen-key.py` +echo $KEY + +sed -e "s/SECRET_KEY = None/SECRET_KEY = $KEY/g" config/env-sample diff --git a/docs/deploy.rst b/docs/deploy.rst index d8f2ec9bb..ac81ac5d3 100644 --- a/docs/deploy.rst +++ b/docs/deploy.rst @@ -18,24 +18,36 @@ alterando o variável DEBUG para false:: DEBUG = False +Arquivos Estáticos +------------------ +Com o ambiente em produção, os arquivos estáticos devem ser servidos pelo web service, em nosso caso o `NGINX`, logo para ter acesso aos arquivos primeiro devemos rodar o seguinte comando:: + + python3 manage.py compilescss + +para que os arquivos SASS/SCSS sejam compilados em arquivos .css em ambiente de produção, e em seguida rode:: + + pyhton3 manage.py collectstatic --no-input + +para coletar todos os arquivos estáticos do projeto e guarda-los no diretório definido em `STATIC_ROOT`, que será também o diretório no qual o `NGINX` irá referenciar para a aplicação. + Instalando Pacotes ------------------ Instalar o NGINX:: sudo apt-get install nginx - - + + Instalar o Gunicorn:: - sudo pip install gunicorn + sudo pip install gunicorn Preparando o NGINX ------------------ sudo nano /etc/nginx/sites-available/sapl31.conf:: - upstream ENDERECO_SITE { + upstream ENDERECO_SITE { server unix:/var/interlegis/sapl/run/gunicorn.sock fail_timeout=0; } @@ -95,11 +107,11 @@ Para uma máquina de CPU única o valor seria 3 Para rodar o gunicorn:: workon sapl - + /var/interlegis/sapl/.gunicorn_start.sh - - - + + + #Referências. http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/ @@ -107,4 +119,12 @@ http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supe Para multiplas aplicações Django. http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/ - + +Compilar arquivos SASS/SCSS + +https://github.com/jrief/django-sass-processor#offline-compilation +https://github.com/jrief/django-sass-processor/issues/34#issuecomment-252611103 + +Deploy Arquivos Estáticos + +https://docs.djangoproject.com/pt-br/1.11/howto/static-files/deployment/ diff --git a/docs/importacao_25_31.rst b/docs/importacao_25_31.rst index 62850d1bc..ba6f48a34 100644 --- a/docs/importacao_25_31.rst +++ b/docs/importacao_25_31.rst @@ -25,7 +25,58 @@ o conteúdo do arquivo será semelhante a isso:: Posteriormente rodar a seguinte sequencia de comandos estando no ambiente virtual:: ./manage.py shell --settings=sapl.legacy_migration_settings - + %run sapl/legacy/migration.py - + migrate() + + +Migração de documentos do sapl 2.5 +---------------------------------- + +No sapl 2.5 todos os documentos ficavam armazenados no ZODB (o banco do Zope). +No sapl 3.1 eles ficam no sistema de arquivos convencional e portanto precisam: + +1. ser exportados para o sistema de arquivos +2. ser vinculados ao novo banco importado para o sapl 3.1 + + +Exportar os documentos para o sistema de arquivos +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Siga os seguintes passos: + +1. Instale o `Products.FSDump` no sapl 2.5. + + Para isso basta colocar a pasta `Products/FSDump` do projeto https://github.com/zopefoundation/Products.FSDump na pasta `Products` da instalação do sapl 2.5 e reiniciar o Zope. + + A pasta a ser instalada é a seguinte: + https://github.com/zopefoundation/Products.FSDump/tree/master/Products/FSDump + +2. Na ZMI, na pasta `sapl_documentos`, adicione um objeto do tipo `Dumper`: + + - Em `Filesystem path` escolha uma pasta do sistema de arquivos local para onde os arquivos serão copiados + - Desmarque a opção `Use .metadata file` + - Clique no botão `Add` + +3. Use o objeto `Dumper` criado para exportar os arquivos: + + - Clique no objeto `Dumper` criado para ver suas opções + - Confira seus parametros e clique em `Change and Dump` + - Aguarde a exportação dos arquivos e verifique que foram copiados para a pasta indicada + + +Vincular os documentos ao novo banco do sapl 3.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Primeiramente migre o banco do sapl 2.5 para o sapl 3.1 + +2. Copie a pasta exportada `sapl_documentos` dentro da pasta `media` da instalação do sapl 3.1 + +3. De forma semelhante ao realizado na migração do banco, dentro no mesmo ambiente virtual, rode os seguintes comandos:: + + ./manage.py shell --settings=sapl.legacy_migration_settings + + %run sapl/legacy/migracao_documentos.py + + migrar_documentos() diff --git a/docs/instacao31.rst b/docs/instacao31.rst index 3d921a4a6..3d6a8b3eb 100644 --- a/docs/instacao31.rst +++ b/docs/instacao31.rst @@ -187,6 +187,9 @@ Copie a chave que aparecerá, edite o arquivo .env e altere o valor do parâmetr ./manage.py collectstatic --noinput +* Preparar o ambiente para indexação de arquivos:: + ./manage.py rebuild_index + * Subir o servidor do django:: ./manage.py runserver 0.0.0.0:8001 diff --git a/docs/solr.rst b/docs/solr.rst new file mode 100644 index 000000000..a81ee9d12 --- /dev/null +++ b/docs/solr.rst @@ -0,0 +1,22 @@ +================================ +Instruções para instalar o Solr +================================ + +Solr é a ferramenta utilizada pelo SAPL 3.1 para indexar documentos para que possa ser feita +a Pesquisa Textual. + + +Dentro do diretório principal siga os seguintes passos:: + + curl -LO https://archive.apache.org/dist/lucene/solr/4.10.2/solr-4.10.2.tgz + tar xvzf solr-4.10.2.tgz + cd solr-4.10.2 + cd example + java -jar start.jar + ./manage.py build_solr_schema --filename solr-4.10.2/example/solr/collection1/conf/schema.xml + + +Após isso, deve-se parar o servidor do Solr e restartar com ``java -jar start.jar`` + + +**OBS: Toda vez que o código da pesquisa textual for modificado, os comandos de build_solr_schema e start.jar devem ser rodados, nessa mesma ordem.** \ No newline at end of file diff --git a/envfile b/envfile new file mode 100644 index 000000000..a7aef4b0f --- /dev/null +++ b/envfile @@ -0,0 +1 @@ +EMAIL_HOST_USER=foo diff --git a/genkey.py b/genkey.py new file mode 100644 index 000000000..85f399c54 --- /dev/null +++ b/genkey.py @@ -0,0 +1,7 @@ +import random + +def generate_secret(): + return ''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) + +if __name__ == '__main__': + print(generate_secret()) diff --git a/gunicorn_start.sh b/gunicorn_start.sh index 904d76a3a..79666cf19 100755 --- a/gunicorn_start.sh +++ b/gunicorn_start.sh @@ -2,8 +2,17 @@ # As seen in http://tutos.readthedocs.org/en/latest/source/ndg.html +SAPL_DIR="/var/interlegis/sapl" + +# Seta um novo diretório foi passado como raiz para o SAPL +# caso esse tenha sido passado como parâmetro +if [ "$1" ] +then + SAPL_DIR="$1" +fi + NAME="SAPL" # Name of the application (*) -DJANGODIR=/var/interlegis/sapl # Django project directory (*) +DJANGODIR=/var/interlegis/sapl/ # Django project directory (*) SOCKFILE=/var/interlegis/sapl/run/gunicorn.sock # we will communicate using this unix socket (*) USER=`whoami` # the user to run as (*) GROUP=`whoami` # the group to run as (*) @@ -12,13 +21,16 @@ NUM_WORKERS=9 # how many worker processes shou DJANGO_SETTINGS_MODULE=sapl.settings # which settings file should Django use (*) DJANGO_WSGI_MODULE=sapl.wsgi # WSGI module name (*) -echo "Starting $NAME as `whoami`" +echo "Starting $NAME as `whoami` on base dir $SAPL_DIR" -# Activate the virtual environment -cd $DJANGODIR -source /var/interlegis/.virtualenvs/sapl/bin/activate -export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE -export PYTHONPATH=$DJANGODIR:$PYTHONPATH +# parameter can be passed to run without virtualenv +if [[ "$@" != "no-venv" ]]; then + # Activate the virtual environment + cd $DJANGODIR + source /var/interlegis/.virtualenvs/sapl/bin/activate + export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE + export PYTHONPATH=$DJANGODIR:$PYTHONPATH +fi # Create the run directory if it doesn't exist RUNDIR=$(dirname $SOCKFILE) diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 89b119a7f..666075b6f 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -6,3 +6,4 @@ ipdb==0.10.1 pip-review==0.4 pygraphviz==1.3.1 pytest-ipdb==0.1-prerelease2 +pipdeptree diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 36ed3844b..fb70f9368 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,5 @@ dj-database-url==0.4.1 +django-haystack==2.6.0 django>=1.9,<1.10 # TODO O django-admin-bootstrapped 2.5.7 não inseriu a mudança que permite # a compatibilidade com Django 1.9+. A linha abaixo será mudada quando uma @@ -14,7 +15,7 @@ django-extra-views==0.8.0 django-filter==0.15.3 django-floppyforms==1.6.2 django-model-utils==2.5 -django-sass-processor==0.4.6 +django-sass-processor==0.5.4 djangorestframework drfdocs easy-thumbnails==2.3 @@ -25,7 +26,10 @@ python-decouple==3.0 pytz==2016.4 pyyaml==3.11 rtyaml==0.0.3 +textract==1.5.0 unipath==1.1 +pysolr==3.6.0 python-magic==0.4.12 gunicorn==19.6.0 django-reversion==2.0.8 +whoosh==2.7.4 diff --git a/sapl/.env_test b/sapl/.env_test index 5c2c60ec1..9416d402d 100644 --- a/sapl/.env_test +++ b/sapl/.env_test @@ -1,4 +1,4 @@ -DATABASE_URL = postgresql://postgres:@localhost:/sapl +DATABASE_URL = postgresql://postgres:@sapldb:/sapl SECRET_KEY=TravisTest DEBUG=False EMAIL_USE_TLS = True diff --git a/sapl/api/serializers.py b/sapl/api/serializers.py index a7ff559e3..21a48a848 100644 --- a/sapl/api/serializers.py +++ b/sapl/api/serializers.py @@ -2,6 +2,7 @@ from rest_framework import serializers from sapl.base.models import Autor from sapl.materia.models import MateriaLegislativa +from sapl.sessao.models import SessaoPlenaria class ChoiceSerializer(serializers.Serializer): @@ -52,3 +53,25 @@ class MateriaLegislativaSerializer(serializers.ModelSerializer): class Meta: model = MateriaLegislativa fields = '__all__' + + +class SessaoPlenariaSerializer(serializers.ModelSerializer): + + tipo = serializers.StringRelatedField(many=False) + sessao_legislativa = serializers.StringRelatedField(many=False) + legislatura = serializers.StringRelatedField(many=False) + + class Meta: + model = SessaoPlenaria + fields = ('pk', + 'tipo', + 'sessao_legislativa', + 'legislatura', + 'data_inicio', + 'hora_inicio', + 'hora_fim', + 'url_video', + 'iniciada', + 'finalizada', + 'interativa' + ) diff --git a/sapl/api/urls.py b/sapl/api/urls.py index 195c7f84a..bf9c16c51 100644 --- a/sapl/api/urls.py +++ b/sapl/api/urls.py @@ -3,7 +3,7 @@ from django.conf.urls import include, url from rest_framework.routers import DefaultRouter from sapl.api.views import (AutorListView, MateriaLegislativaViewSet, - ModelChoiceView) + ModelChoiceView, SessaoPlenariaViewSet) from .apps import AppConfig @@ -12,9 +12,9 @@ app_name = AppConfig.name router = DefaultRouter() router.register(r'materia', MateriaLegislativaViewSet) +router.register(r'sessao-plenaria', SessaoPlenariaViewSet) urlpatterns_router = router.urls - urlpatterns_api = [ url(r'^autor', AutorListView.as_view(), name='autor_list'), diff --git a/sapl/api/views.py b/sapl/api/views.py index 71aa1b225..4a8341c52 100644 --- a/sapl/api/views.py +++ b/sapl/api/views.py @@ -6,16 +6,19 @@ from rest_framework.filters import DjangoFilterBackend from rest_framework.generics import ListAPIView from rest_framework.mixins import ListModelMixin, RetrieveModelMixin from rest_framework.permissions import (IsAuthenticated, - IsAuthenticatedOrReadOnly) -from rest_framework.viewsets import GenericViewSet + IsAuthenticatedOrReadOnly, + AllowAny) +from rest_framework.viewsets import GenericViewSet, ModelViewSet from sapl.api.forms import AutorChoiceFilterSet from sapl.api.serializers import (AutorChoiceSerializer, AutorSerializer, ChoiceSerializer, MateriaLegislativaSerializer, - ModelChoiceSerializer) + ModelChoiceSerializer, + SessaoPlenariaSerializer) from sapl.base.models import Autor, TipoAutor from sapl.materia.models import MateriaLegislativa +from sapl.sessao.models import SessaoPlenaria from sapl.utils import SaplGenericRelation, sapl_logger @@ -203,3 +206,13 @@ class MateriaLegislativaViewSet(ListModelMixin, queryset = MateriaLegislativa.objects.all() filter_backends = (DjangoFilterBackend,) filter_fields = ('numero', 'ano', 'tipo', ) + +class SessaoPlenariaViewSet(ListModelMixin, + RetrieveModelMixin, + GenericViewSet): + + permission_classes = (AllowAny,) + serializer_class = SessaoPlenariaSerializer + queryset = SessaoPlenaria.objects.all() + filter_backends = (DjangoFilterBackend,) + filter_fields = ('data_inicio', 'data_fim', 'interativa') diff --git a/sapl/base/migrations/0001_initial.py b/sapl/base/migrations/0001_initial.py index 8b7f64d04..dd61fdcf5 100644 --- a/sapl/base/migrations/0001_initial.py +++ b/sapl/base/migrations/0001_initial.py @@ -1,38 +1,122 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals +from django.conf import settings from django.db import migrations, models +import django.db.models.deletion +import sapl.base.models class Migration(migrations.Migration): + initial = True + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('contenttypes', '0002_remove_content_type_name'), ] operations = [ + migrations.CreateModel( + name='AppConfig', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('documentos_administrativos', models.CharField(choices=[('O', 'Ostensivo'), ('R', 'Restritivo')], default='O', max_length=1, verbose_name='Ostensivo/Restritivo')), + ('sequencia_numeracao', models.CharField(choices=[('A', 'Sequencial por ano'), ('U', 'Sequencial único')], default='A', max_length=1, verbose_name='Sequência de numeração')), + ('painel_aberto', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Painel aberto para usuário anônimo')), + ('texto_articulado_proposicao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Proposições')), + ('texto_articulado_materia', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Matérias')), + ('texto_articulado_norma', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Usar Textos Articulados para Normas')), + ('proposicao_incorporacao_obrigatoria', models.CharField(choices=[('O', 'Sempre Gerar Protocolo'), ('C', 'Perguntar se é pra gerar protocolo ao incorporar'), ('N', 'Nunca Protocolar ao incorporar uma proposição')], default='O', max_length=1, verbose_name='Regra de incorporação de proposições e protocolo')), + ('cronometro_discurso', models.TimeField(blank=True, null=True, verbose_name='Cronômetro do Discurso')), + ('cronometro_aparte', models.TimeField(blank=True, null=True, verbose_name='Cronômetro do Aparte')), + ('cronometro_ordem', models.TimeField(blank=True, null=True, verbose_name='Cronômetro da Ordem')), + ], + options={ + 'permissions': (('menu_sistemas', 'Renderizar Menu Sistemas'), ('view_tabelas_auxiliares', 'Visualizar Tabelas Auxiliares')), + 'verbose_name': 'Configurações da Aplicação', + 'verbose_name_plural': 'Configurações da Aplicação', + }, + ), + migrations.CreateModel( + name='Autor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.PositiveIntegerField(blank=True, default=None, null=True)), + ('nome', models.CharField(blank=True, max_length=50, verbose_name='Nome do Autor')), + ('cargo', models.CharField(blank=True, max_length=50)), + ('content_type', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ], + options={ + 'verbose_name': 'Autor', + 'verbose_name_plural': 'Autores', + }, + ), migrations.CreateModel( name='CasaLegislativa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('codigo', models.CharField(max_length=100, verbose_name='Codigo')), ('nome', models.CharField(max_length=100, verbose_name='Nome')), ('sigla', models.CharField(max_length=100, verbose_name='Sigla')), ('endereco', models.CharField(max_length=100, verbose_name='Endereço')), ('cep', models.CharField(max_length=100, verbose_name='CEP')), ('municipio', models.CharField(max_length=100, verbose_name='Município')), - ('uf', models.CharField(max_length=100, verbose_name='UF')), - ('telefone', models.CharField(max_length=100, verbose_name='Telefone')), - ('fax', models.CharField(max_length=100, verbose_name='Fax')), - ('cor_fundo', models.CharField(max_length=100, verbose_name='Cor de fundo')), - ('cor_borda', models.CharField(max_length=100, verbose_name='Cor da borda')), - ('cor_principal', models.CharField(max_length=100, verbose_name='Cor principal')), - ('logotipo', models.CharField(max_length=100, verbose_name='Logotipo')), - ('endereco_web', models.CharField(max_length=100, verbose_name='HomePage')), - ('email', models.CharField(max_length=100, verbose_name='E-mail')), - ('informacao_geral', models.CharField(max_length=100, verbose_name='Informação Geral')), + ('uf', models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF')), + ('telefone', models.CharField(blank=True, max_length=100, verbose_name='Telefone')), + ('fax', models.CharField(blank=True, max_length=100, verbose_name='Fax')), + ('logotipo', models.ImageField(blank=True, upload_to='sapl/casa/logotipo/', verbose_name='Logotipo')), + ('endereco_web', models.URLField(blank=True, max_length=100, verbose_name='HomePage')), + ('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')), + ('informacao_geral', models.TextField(blank=True, max_length=100, verbose_name='Informação Geral')), ], options={ - 'verbose_name_plural': 'Casas Legislativas', 'verbose_name': 'Casa Legislativa', + 'verbose_name_plural': 'Casa Legislativa', + }, + ), + migrations.CreateModel( + name='ProblemaMigracao', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.PositiveIntegerField(verbose_name='ID do Objeto')), + ('nome_campo', models.CharField(blank=True, max_length=100, verbose_name='Nome do(s) Campo(s)')), + ('problema', models.CharField(max_length=300, verbose_name='Problema')), + ('descricao', models.CharField(max_length=300, verbose_name='Descrição')), + ('eh_stub', models.BooleanField(verbose_name='É stub?')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Tipo de Content')), + ], + options={ + 'verbose_name': 'Problema na Migração', + 'verbose_name_plural': 'Problemas na Migração', + }, + ), + migrations.CreateModel( + name='TipoAutor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), + ('content_type', models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Modelagem no SAPL')), + ], + options={ + 'ordering': ['descricao'], + 'verbose_name': 'Tipo de Autor', + 'verbose_name_plural': 'Tipos de Autor', }, ), + migrations.AddField( + model_name='autor', + name='tipo', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.TipoAutor', verbose_name='Tipo do Autor'), + ), + migrations.AddField( + model_name='autor', + name='user', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AlterUniqueTogether( + name='autor', + unique_together=set([('content_type', 'object_id')]), + ), ] diff --git a/sapl/base/migrations/0002_auto_20170331_1900.py b/sapl/base/migrations/0002_auto_20170331_1900.py new file mode 100644 index 000000000..5ee726647 --- /dev/null +++ b/sapl/base/migrations/0002_auto_20170331_1900.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-31 19:00 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Argumento', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('argumento', models.CharField(max_length=50, verbose_name='Argumento')), + ], + options={ + 'verbose_name': 'Argumento da constraint', + 'verbose_name_plural': 'Argumentos da constraint', + }, + ), + migrations.CreateModel( + name='Constraint', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome_tabela', models.CharField(max_length=50, verbose_name='Nome da tabela')), + ('nome_constraint', models.CharField(max_length=100, verbose_name='Nome da constraint')), + ('nome_model', models.CharField(max_length=50, verbose_name='Nome da model')), + ('tipo_constraint', models.CharField(max_length=50, verbose_name='Tipo da constraint')), + ], + options={ + 'verbose_name': 'Constraint removida', + 'verbose_name_plural': 'Constraints removidas', + }, + ), + migrations.AddField( + model_name='problemamigracao', + name='eh_importante', + field=models.BooleanField(default=False, verbose_name='É importante?'), + ), + migrations.AddField( + model_name='argumento', + name='constraint', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.Constraint'), + ), + ] diff --git a/sapl/base/migrations/0002_casalegislativa_codigo.py b/sapl/base/migrations/0002_casalegislativa_codigo.py deleted file mode 100644 index 3275904b6..000000000 --- a/sapl/base/migrations/0002_casalegislativa_codigo.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='casalegislativa', - name='codigo', - field=models.CharField(verbose_name='Codigo', default=1, max_length=100), - preserve_default=False, - ), - ] diff --git a/sapl/base/migrations/0003_auto_20160107_1122.py b/sapl/base/migrations/0003_auto_20160107_1122.py deleted file mode 100644 index fb8dd51bd..000000000 --- a/sapl/base/migrations/0003_auto_20160107_1122.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.base.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0002_casalegislativa_codigo'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='logotipo', - field=models.FileField( - null=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo', blank=True), - ), - ] diff --git a/sapl/base/migrations/0004_auto_20160107_1158.py b/sapl/base/migrations/0004_auto_20160107_1158.py deleted file mode 100644 index af51d076f..000000000 --- a/sapl/base/migrations/0004_auto_20160107_1158.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0003_auto_20160107_1122'), - ] - - operations = [ - migrations.RemoveField( - model_name='casalegislativa', - name='cor_borda', - ), - migrations.RemoveField( - model_name='casalegislativa', - name='cor_fundo', - ), - migrations.RemoveField( - model_name='casalegislativa', - name='cor_principal', - ), - ] diff --git a/sapl/base/migrations/0005_auto_20160107_1244.py b/sapl/base/migrations/0005_auto_20160107_1244.py deleted file mode 100644 index f3b06f338..000000000 --- a/sapl/base/migrations/0005_auto_20160107_1244.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0004_auto_20160107_1158'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='email', - field=models.CharField(max_length=100, null=True, verbose_name='E-mail', blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='endereco_web', - field=models.CharField(max_length=100, null=True, verbose_name='HomePage', blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='fax', - field=models.CharField(max_length=100, null=True, verbose_name='Fax', blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='informacao_geral', - field=models.CharField(max_length=100, null=True, verbose_name='Informação Geral', blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='telefone', - field=models.CharField(max_length=100, null=True, verbose_name='Telefone', blank=True), - ), - ] diff --git a/sapl/base/migrations/0006_auto_20160107_1257.py b/sapl/base/migrations/0006_auto_20160107_1257.py deleted file mode 100644 index 4f0e69522..000000000 --- a/sapl/base/migrations/0006_auto_20160107_1257.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0005_auto_20160107_1244'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='informacao_geral', - field=models.CharField(verbose_name='Informação Geral', max_length=100, default=1), - preserve_default=False, - ), - ] diff --git a/sapl/base/migrations/0007_auto_20160107_1837.py b/sapl/base/migrations/0007_auto_20160107_1837.py deleted file mode 100644 index 58714badf..000000000 --- a/sapl/base/migrations/0007_auto_20160107_1837.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import sapl.base.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0006_auto_20160107_1257'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='informacao_geral', - field=models.CharField( - blank=True, max_length=100, verbose_name='Informação Geral', null=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='logotipo', - field=models.ImageField( - blank=True, upload_to=sapl.base.models.get_casa_media_path, verbose_name='Logotipo', null=True), - ), - ] diff --git a/sapl/base/migrations/0008_auto_20160216_1015.py b/sapl/base/migrations/0008_auto_20160216_1015.py deleted file mode 100644 index d969a82e0..000000000 --- a/sapl/base/migrations/0008_auto_20160216_1015.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import models, migrations -from django.utils.timezone import utc - -import sapl.base.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0007_auto_20160107_1837'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='email', - field=models.CharField(verbose_name='E-mail', max_length=100, default=datetime.datetime( - 2016, 2, 16, 12, 15, 30, 241941, tzinfo=utc), blank=True), - preserve_default=False, - ), - migrations.AlterField( - model_name='casalegislativa', - name='endereco_web', - field=models.CharField( - verbose_name='HomePage', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='fax', - field=models.CharField( - verbose_name='Fax', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='informacao_geral', - field=models.CharField( - verbose_name='Informação Geral', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='logotipo', - field=models.ImageField( - verbose_name='Logotipo', upload_to=sapl.base.models.get_casa_media_path, blank=True), - ), - migrations.AlterField( - model_name='casalegislativa', - name='telefone', - field=models.CharField( - verbose_name='Telefone', max_length=100, blank=True), - ), - ] diff --git a/sapl/base/migrations/0009_auto_20160307_0905.py b/sapl/base/migrations/0009_auto_20160307_0905.py deleted file mode 100644 index adecc2ac3..000000000 --- a/sapl/base/migrations/0009_auto_20160307_0905.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0008_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='email', - field=models.EmailField(blank=True, max_length=100, verbose_name='E-mail'), - ), - migrations.AlterField( - model_name='casalegislativa', - name='endereco_web', - field=models.URLField(blank=True, max_length=100, verbose_name='HomePage'), - ), - ] diff --git a/sapl/base/migrations/0010_auto_20160309_1323.py b/sapl/base/migrations/0010_auto_20160309_1323.py deleted file mode 100644 index d0caee056..000000000 --- a/sapl/base/migrations/0010_auto_20160309_1323.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-09 16:23 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0009_auto_20160307_0905'), - ] - - operations = [ - migrations.AlterField( - model_name='casalegislativa', - name='informacao_geral', - field=models.TextField(blank=True, max_length=100, verbose_name='Informação Geral'), - ), - migrations.AlterField( - model_name='casalegislativa', - name='uf', - field=models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF'), - ), - ] diff --git a/sapl/base/migrations/0011_problemamigracao.py b/sapl/base/migrations/0011_problemamigracao.py deleted file mode 100644 index aa8eae5ce..000000000 --- a/sapl/base/migrations/0011_problemamigracao.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-19 16:02 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('base', '0010_auto_20160309_1323'), - ] - - operations = [ - migrations.CreateModel( - name='ProblemaMigracao', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('object_id', models.PositiveIntegerField(verbose_name='ID do Objeto')), - ('problema', models.CharField(max_length=300, null=True, verbose_name='Problema')), - ('descricao', models.CharField(max_length=300, null=True, verbose_name='Descrição')), - ('endereco', models.URLField(null=True, verbose_name='Endereço')), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Tipo de Content')), - ], - options={ - 'verbose_name_plural': 'Problemas na Migração', - 'verbose_name': 'Problema na Migração', - }, - ), - ] diff --git a/sapl/base/migrations/0012_problemamigracao_eh_stub.py b/sapl/base/migrations/0012_problemamigracao_eh_stub.py deleted file mode 100644 index b145c3383..000000000 --- a/sapl/base/migrations/0012_problemamigracao_eh_stub.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-04-26 17:41 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0011_problemamigracao'), - ] - - operations = [ - migrations.AddField( - model_name='problemamigracao', - name='eh_stub', - field=models.BooleanField(default=False, verbose_name='É stub?'), - preserve_default=False, - ), - ] diff --git a/sapl/base/migrations/0013_remove_problemamigracao_endereco.py b/sapl/base/migrations/0013_remove_problemamigracao_endereco.py deleted file mode 100644 index 67526693d..000000000 --- a/sapl/base/migrations/0013_remove_problemamigracao_endereco.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-02 17:36 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0012_problemamigracao_eh_stub'), - ] - - operations = [ - migrations.RemoveField( - model_name='problemamigracao', - name='endereco', - ), - ] diff --git a/sapl/base/migrations/0014_auto_20160502_1635.py b/sapl/base/migrations/0014_auto_20160502_1635.py deleted file mode 100644 index 6fbae0bb9..000000000 --- a/sapl/base/migrations/0014_auto_20160502_1635.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-02 19:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0013_remove_problemamigracao_endereco'), - ] - - operations = [ - migrations.AlterField( - model_name='problemamigracao', - name='descricao', - field=models.CharField(default='', max_length=300, verbose_name='Descrição'), - preserve_default=False, - ), - migrations.AlterField( - model_name='problemamigracao', - name='problema', - field=models.CharField(default='', max_length=300, verbose_name='Problema'), - preserve_default=False, - ), - ] diff --git a/sapl/base/migrations/0015_problemamigracao_nome_campo.py b/sapl/base/migrations/0015_problemamigracao_nome_campo.py deleted file mode 100644 index 07be71fb1..000000000 --- a/sapl/base/migrations/0015_problemamigracao_nome_campo.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 20:34 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0014_auto_20160502_1635'), - ] - - operations = [ - migrations.AddField( - model_name='problemamigracao', - name='nome_campo', - field=models.CharField(blank=True, max_length=100, verbose_name='Nome do(s) Campo(s)'), - ), - ] diff --git a/sapl/base/migrations/0016_auto_20160701_0940.py b/sapl/base/migrations/0016_auto_20160701_0940.py deleted file mode 100644 index 0347cbd19..000000000 --- a/sapl/base/migrations/0016_auto_20160701_0940.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-07-01 12:40 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0015_problemamigracao_nome_campo'), - ] - - operations = [ - migrations.AlterModelOptions( - name='casalegislativa', - options={'verbose_name': 'Casa Legislativa', 'verbose_name_plural': 'Casa Legislativa'}, - ), - ] diff --git a/sapl/base/migrations/0017_appconfig.py b/sapl/base/migrations/0017_appconfig.py deleted file mode 100644 index d162248c8..000000000 --- a/sapl/base/migrations/0017_appconfig.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-15 18:19 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0016_auto_20160701_0940'), - ] - - operations = [ - migrations.CreateModel( - name='AppConfig', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('documentos_administrativos', models.CharField(blank=True, choices=[('O', 'Ostensivo'), ('R', 'Restritivo')], max_length=1, null=True, verbose_name='Ostensivo/Restritivo')), - ('sequencia_numeracao', models.CharField(blank=True, choices=[('A', 'Sequencial por ano'), ('U', 'Sequencial único')], max_length=1, null=True, verbose_name='Sequência de numeração')), - ('painel_aberto', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Painel aberto para usuário anônimo')), - ], - ), - ] diff --git a/sapl/base/migrations/0018_auto_20160919_1333.py b/sapl/base/migrations/0018_auto_20160919_1333.py deleted file mode 100644 index f21ba8131..000000000 --- a/sapl/base/migrations/0018_auto_20160919_1333.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-19 16:33 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0017_appconfig'), - ] - - operations = [ - migrations.AlterModelOptions( - name='appconfig', - options={'verbose_name': 'Configurações da Aplicação', 'verbose_name_plural': 'Configurações da Aplicação'}, - ), - migrations.AlterField( - model_name='appconfig', - name='documentos_administrativos', - field=models.CharField(choices=[('O', 'Ostensivo'), ('R', 'Restritivo')], default='O', max_length=1, verbose_name='Ostensivo/Restritivo'), - ), - migrations.AlterField( - model_name='appconfig', - name='painel_aberto', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Painel aberto para usuário anônimo'), - ), - migrations.AlterField( - model_name='appconfig', - name='sequencia_numeracao', - field=models.CharField(choices=[('A', 'Sequencial por ano'), ('U', 'Sequencial único')], default='A', max_length=1, verbose_name='Sequência de numeração'), - ), - ] diff --git a/sapl/base/migrations/0019_auto_20160928_1951.py b/sapl/base/migrations/0019_auto_20160928_1951.py deleted file mode 100644 index 9c61f7062..000000000 --- a/sapl/base/migrations/0019_auto_20160928_1951.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-28 22:51 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0018_auto_20160919_1333'), - ] - - operations = [ - migrations.AlterModelOptions( - name='appconfig', - options={'permissions': (('menu_sistemas', 'Renderizar Menu Sistemas'), ('view_tabelas_auxiliares', 'Visualizar Tabelas Auxiliares')), 'verbose_name': 'Configurações da Aplicação', 'verbose_name_plural': 'Configurações da Aplicação'}, - ), - ] diff --git a/sapl/base/migrations/0020_auto_20161006_0950.py b/sapl/base/migrations/0020_auto_20161006_0950.py deleted file mode 100644 index 71f9f9a6b..000000000 --- a/sapl/base/migrations/0020_auto_20161006_0950.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-06 12:50 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0019_auto_20160928_1951'), - ] - - operations = [ - migrations.AddField( - model_name='appconfig', - name='texto_articulado_materia', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Matérias'), - ), - migrations.AddField( - model_name='appconfig', - name='texto_articulado_norma', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Normas'), - ), - migrations.AddField( - model_name='appconfig', - name='texto_articulado_proposicao', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Usar Textos Articulados para Proposições'), - ), - ] diff --git a/sapl/base/migrations/0021_auto_20161006_1019.py b/sapl/base/migrations/0021_auto_20161006_1019.py deleted file mode 100644 index 107cca4d4..000000000 --- a/sapl/base/migrations/0021_auto_20161006_1019.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-06 13:19 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0020_auto_20161006_0950'), - ] - - operations = [ - migrations.AlterField( - model_name='appconfig', - name='texto_articulado_norma', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Usar Textos Articulados para Normas'), - ), - ] diff --git a/sapl/base/migrations/0022_auto_20161009_1222.py b/sapl/base/migrations/0022_auto_20161009_1222.py deleted file mode 100644 index 37794c428..000000000 --- a/sapl/base/migrations/0022_auto_20161009_1222.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-09 15:22 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('contenttypes', '0002_remove_content_type_name'), - ('base', '0021_auto_20161006_1019'), - ] - - operations = [ - migrations.CreateModel( - name='Autor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('object_id', models.PositiveIntegerField(blank=True, default=None, null=True)), - ('nome', models.CharField(blank=True, max_length=50, verbose_name='Autor')), - ('cargo', models.CharField(blank=True, max_length=50)), - ('content_type', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), - ], - options={ - 'verbose_name': 'Autor', - 'verbose_name_plural': 'Autores', - }, - ), - migrations.CreateModel( - name='TipoAutor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ('content_type', models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Modelo do Tipo de Autor')), - ], - options={ - 'verbose_name': 'Tipo de Autor', - 'verbose_name_plural': 'Tipos de Autor', - }, - ), - migrations.AddField( - model_name='autor', - name='tipo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.TipoAutor', verbose_name='Tipo'), - ), - migrations.AddField( - model_name='autor', - name='user', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/sapl/base/migrations/0023_auto_20161009_1852.py b/sapl/base/migrations/0023_auto_20161009_1852.py deleted file mode 100644 index 79baef066..000000000 --- a/sapl/base/migrations/0023_auto_20161009_1852.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-09 21:52 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0022_auto_20161009_1222'), - ] - - operations = [ - migrations.AlterField( - model_name='tipoautor', - name='content_type', - field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Modelagem no SAPL'), - ), - migrations.AlterUniqueTogether( - name='autor', - unique_together=set([('content_type', 'object_id')]), - ), - ] diff --git a/sapl/base/migrations/0024_auto_20161010_1002.py b/sapl/base/migrations/0024_auto_20161010_1002.py deleted file mode 100644 index 0de18cad7..000000000 --- a/sapl/base/migrations/0024_auto_20161010_1002.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-10 13:02 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0023_auto_20161009_1852'), - ] - - operations = [ - migrations.AlterField( - model_name='autor', - name='nome', - field=models.CharField(blank=True, max_length=50, verbose_name='Nome do Autor'), - ), - migrations.AlterField( - model_name='autor', - name='tipo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.TipoAutor', verbose_name='Tipo do Autor'), - ), - ] diff --git a/sapl/base/migrations/0025_tipoautor_cria_usuario.py b/sapl/base/migrations/0025_tipoautor_cria_usuario.py deleted file mode 100644 index ba36e092c..000000000 --- a/sapl/base/migrations/0025_tipoautor_cria_usuario.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 14:38 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0024_auto_20161010_1002'), - ] - - operations = [ - migrations.AddField( - model_name='tipoautor', - name='cria_usuario', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, help_text='Criação de Usuários víncula e libera o acesso de Autores ao sistema. Vincular um Autor a um tipo que esta opção está marcada como "Não", o Autor não terá username associado.', verbose_name='Criação de Usuários'), - ), - ] diff --git a/sapl/base/migrations/0026_remove_tipoautor_cria_usuario.py b/sapl/base/migrations/0026_remove_tipoautor_cria_usuario.py deleted file mode 100644 index 948427836..000000000 --- a/sapl/base/migrations/0026_remove_tipoautor_cria_usuario.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 18:08 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0025_tipoautor_cria_usuario'), - ] - - operations = [ - migrations.RemoveField( - model_name='tipoautor', - name='cria_usuario', - ), - ] diff --git a/sapl/base/migrations/0027_auto_20161011_1624.py b/sapl/base/migrations/0027_auto_20161011_1624.py deleted file mode 100644 index ff6eae09d..000000000 --- a/sapl/base/migrations/0027_auto_20161011_1624.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 19:24 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0026_remove_tipoautor_cria_usuario'), - ] - - operations = [ - migrations.AlterField( - model_name='autor', - name='user', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/sapl/base/migrations/0028_appconfig_proposicao_incorporacao_obrigatoria.py b/sapl/base/migrations/0028_appconfig_proposicao_incorporacao_obrigatoria.py deleted file mode 100644 index 131aa99a7..000000000 --- a/sapl/base/migrations/0028_appconfig_proposicao_incorporacao_obrigatoria.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-21 14:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0027_auto_20161011_1624'), - ] - - operations = [ - migrations.AddField( - model_name='appconfig', - name='proposicao_incorporacao_obrigatoria', - field=models.BooleanField(choices=[('O', 'Sempre Gerar Protocolo.'), ('C', 'Perguntar se é pra gerar protocolo ao incorporar.'), ('N', 'Nunca Protocolar ao incorporar uma proposição.')], default='O', verbose_name='Regra de incorporação e protocolo'), - ), - ] diff --git a/sapl/base/migrations/0029_auto_20161021_1445.py b/sapl/base/migrations/0029_auto_20161021_1445.py deleted file mode 100644 index 4f01852f1..000000000 --- a/sapl/base/migrations/0029_auto_20161021_1445.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-21 14:45 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0028_appconfig_proposicao_incorporacao_obrigatoria'), - ] - - operations = [ - migrations.AlterField( - model_name='appconfig', - name='proposicao_incorporacao_obrigatoria', - field=models.BooleanField(choices=[('O', 'Sempre Gerar Protocolo'), ('C', 'Perguntar se é pra gerar protocolo ao incorporar'), ('N', 'Nunca Protocolar ao incorporar uma proposição')], default='O', verbose_name='Regra de incorporação de proposições e protocolo'), - ), - ] diff --git a/sapl/base/migrations/0030_auto_20161021_2017.py b/sapl/base/migrations/0030_auto_20161021_2017.py deleted file mode 100644 index 1aa346a40..000000000 --- a/sapl/base/migrations/0030_auto_20161021_2017.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-21 20:17 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0029_auto_20161021_1445'), - ] - - operations = [ - migrations.AlterField( - model_name='appconfig', - name='proposicao_incorporacao_obrigatoria', - field=models.CharField(choices=[('O', 'Sempre Gerar Protocolo'), ('C', 'Perguntar se é pra gerar protocolo ao incorporar'), ('N', 'Nunca Protocolar ao incorporar uma proposição')], default='O', max_length=1, verbose_name='Regra de incorporação de proposições e protocolo'), - ), - ] diff --git a/sapl/base/migrations/0031_auto_20170203_1019.py b/sapl/base/migrations/0031_auto_20170203_1019.py deleted file mode 100644 index b992ed44f..000000000 --- a/sapl/base/migrations/0031_auto_20170203_1019.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-03 10:19 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0030_auto_20161021_2017'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tipoautor', - options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Autor', 'verbose_name_plural': 'Tipos de Autor'}, - ), - ] diff --git a/sapl/base/migrations/0032_auto_20170308_1006.py b/sapl/base/migrations/0032_auto_20170308_1006.py deleted file mode 100644 index 61172bbda..000000000 --- a/sapl/base/migrations/0032_auto_20170308_1006.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-08 10:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0031_auto_20170203_1019'), - ] - - operations = [ - migrations.AddField( - model_name='appconfig', - name='cronometro_aparte', - field=models.TimeField(blank=True, null=True, verbose_name='Cronômetro do Aparte'), - ), - migrations.AddField( - model_name='appconfig', - name='cronometro_discurso', - field=models.TimeField(blank=True, null=True, verbose_name='Cronômetro do Discurso'), - ), - migrations.AddField( - model_name='appconfig', - name='cronometro_ordem', - field=models.TimeField(blank=True, null=True, verbose_name='Cronômetro da Ordem'), - ), - ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 640bb7d52..9dd0f5ec3 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -13,14 +13,6 @@ SEQUENCIA_NUMERACAO = (('A', _('Sequencial por ano')), ('U', _('Sequencial único'))) -def get_sessao_media_path(instance, subpath, filename): - return './sapl/casa/%s/%s' % (subpath, filename) - - -def get_casa_media_path(instance, filename): - return get_sessao_media_path(instance, 'Logotipo', filename) - - @reversion.register() class CasaLegislativa(models.Model): # TODO ajustar todos os max_length !!!! @@ -41,7 +33,7 @@ class CasaLegislativa(models.Model): max_length=100, blank=True, verbose_name=_('Fax')) logotipo = models.ImageField( blank=True, - upload_to=get_casa_media_path, + upload_to='sapl/casa/logotipo/', verbose_name=_('Logotipo')) endereco_web = models.URLField( max_length=100, blank=True, verbose_name=_('HomePage')) @@ -69,16 +61,45 @@ class ProblemaMigracao(models.Model): content_object = GenericForeignKey('content_type', 'object_id') nome_campo = models.CharField(max_length=100, blank=True, - verbose_name='Nome do(s) Campo(s)') + verbose_name=_('Nome do(s) Campo(s)')) problema = models.CharField(max_length=300, verbose_name=_('Problema')) descricao = models.CharField(max_length=300, verbose_name=_('Descrição')) - eh_stub = models.BooleanField(verbose_name='É stub?') + eh_stub = models.BooleanField(verbose_name=_('É stub?')) + eh_importante = models.BooleanField( + default=False, verbose_name=_('É importante?')) class Meta: verbose_name = _('Problema na Migração') verbose_name_plural = _('Problemas na Migração') +@reversion.register() +class Constraint(models.Model): + nome_tabela = models.CharField( + max_length=50, verbose_name=_('Nome da tabela')) + nome_constraint = models.CharField( + max_length=100, verbose_name=_('Nome da constraint')) + nome_model = models.CharField( + max_length=50, verbose_name=_('Nome da model')) + tipo_constraint = models.CharField( + max_length=50, verbose_name=_('Tipo da constraint')) + + class Meta: + verbose_name = _('Constraint removida') + verbose_name_plural = _('Constraints removidas') + + +@reversion.register() +class Argumento(models.Model): + constraint = models.ForeignKey(Constraint) + argumento = models.CharField( + max_length=50, verbose_name=_('Argumento')) + + class Meta: + verbose_name = _('Argumento da constraint') + verbose_name_plural = _('Argumentos da constraint') + + @reversion.register() class AppConfig(models.Model): diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py new file mode 100644 index 000000000..c85be523b --- /dev/null +++ b/sapl/base/search_indexes.py @@ -0,0 +1,72 @@ +import os.path + +import textract +from django.template import Context, loader +from haystack import indexes + +from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa +from sapl.norma.models import NormaJuridica + + +class DocumentoAcessorioIndex(indexes.SearchIndex, indexes.Indexable): + text = indexes.CharField(document=True, use_template=True) + + filename = 'arquivo' + model = DocumentoAcessorio + template_name = 'materia/documentoacessorio_text.txt' + + def get_model(self): + return self.model + + def index_queryset(self, using=None): + return self.get_model().objects.all() + + def prepare(self, obj): + if not self.filename or not self.model or not self.template_name: + raise Exception + + data = super(DocumentoAcessorioIndex, self).prepare(obj) + + arquivo = getattr(obj, self.filename) + + if arquivo: + try: + arquivo.open() + except OSError: + return self.prepared_data + + if not os.path.splitext(arquivo.path)[1][:1]: + return self.prepared_data + + extracted_data = textract.process( + arquivo.path).decode( + 'utf-8').replace('\n', ' ') + + extracted_data = extracted_data.replace('\t', ' ') + + # Now we'll finally perform the template processing to render the + # text field with *all* of our metadata visible for templating: + t = loader.select_template(( + 'search/indexes/' + self.template_name, )) + data['text'] = t.render(Context({'object': obj, + 'extracted': extracted_data})) + + return data + + return self.prepared_data + + +class MateriaLegislativaIndex(DocumentoAcessorioIndex): + text = indexes.CharField(document=True, use_template=True) + + filename = 'texto_original' + model = MateriaLegislativa + template_name = 'materia/materialegislativa_text.txt' + + +class NormaJuridicaIndex(DocumentoAcessorioIndex): + text = indexes.CharField(document=True, use_template=True) + + filename = 'texto_integral' + model = NormaJuridica + template_name = 'norma/normajuridica_text.txt' diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 9d643e70c..419899632 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -2,6 +2,8 @@ from compressor.utils import get_class from django import template from sapl.base.models import AppConfig +from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa +from sapl.norma.models import NormaJuridica from sapl.parlamentares.models import Filiacao register = template.Library() @@ -124,7 +126,7 @@ def url(value): @register.filter -def cronometro_to_seconds(value): +def cronometro_to_seconds(value): if not AppConfig.attr('cronometro_' + value): return 0 @@ -137,3 +139,15 @@ def cronometro_to_seconds(value): @register.filter def to_list_pk(object_list): return [o.pk for o in object_list] + + +@register.filter +def search_get_model(object): + if type(object) == MateriaLegislativa: + return 'm' + elif type(object) == DocumentoAcessorio: + return 'd' + elif type(object) == NormaJuridica: + return 'n' + + return None diff --git a/sapl/base/urls.py b/sapl/base/urls.py index 361ab2cda..d5e4ae98a 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -99,4 +99,6 @@ urlpatterns = [ name='login'), url(r'^logout/$', views.logout, {'next_page': '/login'}, name='logout'), + url(r'^sistema/search/', include('haystack.urls')), + ] + recuperar_senha diff --git a/sapl/comissoes/migrations/0001_initial.py b/sapl/comissoes/migrations/0001_initial.py index 42cd116fa..584ef5131 100644 --- a/sapl/comissoes/migrations/0001_initial.py +++ b/sapl/comissoes/migrations/0001_initial.py @@ -1,11 +1,15 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): + initial = True + dependencies = [ ('parlamentares', '0001_initial'), ] @@ -14,107 +18,108 @@ class Migration(migrations.Migration): migrations.CreateModel( name='CargoComissao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Cargo')), - ('unico', models.BooleanField(verbose_name='Único')), + ('unico', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Único')), ], options={ - 'verbose_name_plural': 'Cargos de Comissão', 'verbose_name': 'Cargo de Comissão', + 'verbose_name_plural': 'Cargos de Comissão', }, ), migrations.CreateModel( name='Comissao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=60, verbose_name='Nome')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')), ('data_criacao', models.DateField(verbose_name='Data de Criação')), ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data de Extinção')), - ('apelido_temp', models.CharField(blank=True, max_length=100, null=True, verbose_name='Apelido')), + ('apelido_temp', models.CharField(blank=True, max_length=100, verbose_name='Apelido')), ('data_instalacao_temp', models.DateField(blank=True, null=True, verbose_name='Data Instalação')), ('data_final_prevista_temp', models.DateField(blank=True, null=True, verbose_name='Data Prevista Término')), ('data_prorrogada_temp', models.DateField(blank=True, null=True, verbose_name='Novo Prazo')), ('data_fim_comissao', models.DateField(blank=True, null=True, verbose_name='Data Término')), - ('secretario', models.CharField(blank=True, max_length=30, null=True, verbose_name='Secretário')), - ('telefone_reuniao', models.CharField(blank=True, max_length=15, null=True, verbose_name='Tel. Sala Reunião')), - ('endereco_secretaria', models.CharField(blank=True, max_length=100, null=True, verbose_name='Endereço Secretaria')), - ('telefone_secretaria', models.CharField(blank=True, max_length=15, null=True, verbose_name='Tel. Secretaria')), - ('fax_secretaria', models.CharField(blank=True, max_length=15, null=True, verbose_name='Fax Secretaria')), - ('agenda_reuniao', models.CharField(blank=True, max_length=100, null=True, verbose_name='Data/Hora Reunião')), - ('local_reuniao', models.CharField(blank=True, max_length=100, null=True, verbose_name='Local Reunião')), - ('finalidade', models.TextField(blank=True, null=True, verbose_name='Finalidade')), - ('email', models.CharField(blank=True, max_length=100, null=True, verbose_name='E-mail')), - ('unidade_deliberativa', models.BooleanField(verbose_name='Unidade Deliberativa', choices=[(True, 'Sim'), (False, 'Não')])), + ('secretario', models.CharField(blank=True, max_length=30, verbose_name='Secretário')), + ('telefone_reuniao', models.CharField(blank=True, max_length=15, verbose_name='Tel. Sala Reunião')), + ('endereco_secretaria', models.CharField(blank=True, max_length=100, verbose_name='Endereço Secretaria')), + ('telefone_secretaria', models.CharField(blank=True, max_length=15, verbose_name='Tel. Secretaria')), + ('fax_secretaria', models.CharField(blank=True, max_length=15, verbose_name='Fax Secretaria')), + ('agenda_reuniao', models.CharField(blank=True, max_length=100, verbose_name='Data/Hora Reunião')), + ('local_reuniao', models.CharField(blank=True, max_length=100, verbose_name='Local Reunião')), + ('finalidade', models.TextField(blank=True, verbose_name='Finalidade')), + ('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')), + ('unidade_deliberativa', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Unidade Deliberativa')), + ('ativa', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Comissão Ativa?')), ], options={ - 'verbose_name_plural': 'Comissões', 'verbose_name': 'Comissão', + 'verbose_name_plural': 'Comissões', }, ), migrations.CreateModel( name='Composicao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('comissao', models.ForeignKey(to='comissoes.Comissao', verbose_name='Comissão')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comissao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.Comissao', verbose_name='Comissão')), ], options={ - 'verbose_name_plural': 'Composições de Comissão', 'verbose_name': 'Composição de Comissão', + 'verbose_name_plural': 'Composições de Comissão', }, ), migrations.CreateModel( name='Participacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('titular', models.BooleanField(verbose_name='Titular')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('titular', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Titular')), ('data_designacao', models.DateField(verbose_name='Data Designação')), ('data_desligamento', models.DateField(blank=True, null=True, verbose_name='Data Desligamento')), - ('motivo_desligamento', models.CharField(blank=True, max_length=150, null=True, verbose_name='Motivo Desligamento')), - ('observacao', models.CharField(blank=True, max_length=150, null=True, verbose_name='Observação')), - ('cargo', models.ForeignKey(to='comissoes.CargoComissao')), - ('composicao', models.ForeignKey(to='comissoes.Composicao')), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar')), + ('motivo_desligamento', models.CharField(blank=True, max_length=150, verbose_name='Motivo Desligamento')), + ('observacao', models.CharField(blank=True, max_length=150, verbose_name='Observação')), + ('cargo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.CargoComissao')), + ('composicao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='participacao_set', to='comissoes.Composicao')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), ], options={ - 'verbose_name_plural': 'Participações em Comissão', 'verbose_name': 'Participação em Comissão', + 'verbose_name_plural': 'Participações em Comissão', }, ), migrations.CreateModel( name='Periodo', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_inicio', models.DateField(verbose_name='Data Início')), ('data_fim', models.DateField(blank=True, null=True, verbose_name='Data Fim')), ], options={ - 'verbose_name_plural': 'Períodos de composição de Comissão', 'verbose_name': 'Período de composição de Comissão', + 'verbose_name_plural': 'Períodos de composição de Comissão', }, ), migrations.CreateModel( name='TipoComissao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('natureza', models.CharField(choices=[('T', 'Temporária'), ('P', 'Permanente')], max_length=1, verbose_name='Natureza')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')), - ('dispositivo_regimental', models.CharField(blank=True, max_length=50, null=True, verbose_name='Dispositivo Regimental')), + ('dispositivo_regimental', models.CharField(blank=True, max_length=50, verbose_name='Dispositivo Regimental')), ], options={ - 'verbose_name_plural': 'Tipos de Comissão', 'verbose_name': 'Tipo de Comissão', + 'verbose_name_plural': 'Tipos de Comissão', }, ), migrations.AddField( model_name='composicao', name='periodo', - field=models.ForeignKey(to='comissoes.Periodo', verbose_name='Período'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.Periodo', verbose_name='Período'), ), migrations.AddField( model_name='comissao', name='tipo', - field=models.ForeignKey(to='comissoes.TipoComissao', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.TipoComissao', verbose_name='Tipo'), ), ] diff --git a/sapl/comissoes/migrations/0002_auto_20150729_1310.py b/sapl/comissoes/migrations/0002_auto_20150729_1310.py deleted file mode 100644 index eef2e558e..000000000 --- a/sapl/comissoes/migrations/0002_auto_20150729_1310.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='cargocomissao', - name='unico', - field=models.BooleanField(verbose_name='Único', choices=[(True, 'Sim'), (False, 'Não')]), - ), - ] diff --git a/sapl/comissoes/migrations/0003_auto_20160216_1015.py b/sapl/comissoes/migrations/0003_auto_20160216_1015.py deleted file mode 100644 index b4108ae12..000000000 --- a/sapl/comissoes/migrations/0003_auto_20160216_1015.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0002_auto_20150729_1310'), - ] - - operations = [ - migrations.AlterField( - model_name='comissao', - name='agenda_reuniao', - field=models.CharField(verbose_name='Data/Hora Reunião', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='apelido_temp', - field=models.CharField(verbose_name='Apelido', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='email', - field=models.CharField(verbose_name='E-mail', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='endereco_secretaria', - field=models.CharField(verbose_name='Endereço Secretaria', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='fax_secretaria', - field=models.CharField(verbose_name='Fax Secretaria', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='finalidade', - field=models.TextField(verbose_name='Finalidade', blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='local_reuniao', - field=models.CharField(verbose_name='Local Reunião', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='secretario', - field=models.CharField(verbose_name='Secretário', max_length=30, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='telefone_reuniao', - field=models.CharField(verbose_name='Tel. Sala Reunião', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='comissao', - name='telefone_secretaria', - field=models.CharField(verbose_name='Tel. Secretaria', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='participacao', - name='motivo_desligamento', - field=models.CharField(verbose_name='Motivo Desligamento', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='participacao', - name='observacao', - field=models.CharField(verbose_name='Observação', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='tipocomissao', - name='dispositivo_regimental', - field=models.CharField(verbose_name='Dispositivo Regimental', max_length=50, blank=True), - ), - ] diff --git a/sapl/comissoes/migrations/0004_auto_20160307_0905.py b/sapl/comissoes/migrations/0004_auto_20160307_0905.py deleted file mode 100644 index 0cad7d62e..000000000 --- a/sapl/comissoes/migrations/0004_auto_20160307_0905.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0003_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='comissao', - name='email', - field=models.EmailField(blank=True, max_length=100, verbose_name='E-mail'), - ), - ] diff --git a/sapl/comissoes/migrations/0005_comissao_ativa.py b/sapl/comissoes/migrations/0005_comissao_ativa.py deleted file mode 100644 index 930bf276c..000000000 --- a/sapl/comissoes/migrations/0005_comissao_ativa.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-05 18:36 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0004_auto_20160307_0905'), - ] - - operations = [ - migrations.AddField( - model_name='comissao', - name='ativa', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Comissão Ativa?'), - preserve_default=False, - ), - ] diff --git a/sapl/comissoes/migrations/0006_auto_20160825_1335.py b/sapl/comissoes/migrations/0006_auto_20160825_1335.py deleted file mode 100644 index f165a94ea..000000000 --- a/sapl/comissoes/migrations/0006_auto_20160825_1335.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-25 16:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0005_comissao_ativa'), - ] - - operations = [ - migrations.AlterField( - model_name='comissao', - name='ativa', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Comissão Ativa?'), - ), - ] diff --git a/sapl/comissoes/migrations/0006_auto_20160916_1243.py b/sapl/comissoes/migrations/0006_auto_20160916_1243.py deleted file mode 100644 index 1c5fcaa9c..000000000 --- a/sapl/comissoes/migrations/0006_auto_20160916_1243.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 15:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0005_comissao_ativa'), - ] - - operations = [ - migrations.AlterField( - model_name='comissao', - name='ativa', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Comissão Ativa?'), - ), - ] diff --git a/sapl/comissoes/migrations/0007_merge.py b/sapl/comissoes/migrations/0007_merge.py deleted file mode 100644 index d2ed51932..000000000 --- a/sapl/comissoes/migrations/0007_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-19 15:48 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0006_auto_20160916_1243'), - ('comissoes', '0006_auto_20160825_1335'), - ] - - operations = [ - ] diff --git a/sapl/comissoes/migrations/0008_auto_20160929_1611.py b/sapl/comissoes/migrations/0008_auto_20160929_1611.py deleted file mode 100644 index 5e90c95b4..000000000 --- a/sapl/comissoes/migrations/0008_auto_20160929_1611.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 19:11 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0007_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='participacao', - name='composicao', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participacao_set', to='comissoes.Composicao'), - ), - ] diff --git a/sapl/comissoes/migrations/0009_auto_20161011_0843.py b/sapl/comissoes/migrations/0009_auto_20161011_0843.py deleted file mode 100644 index 4fb4fde79..000000000 --- a/sapl/comissoes/migrations/0009_auto_20161011_0843.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 11:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0008_auto_20160929_1611'), - ] - - operations = [ - migrations.AlterField( - model_name='participacao', - name='titular', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Titular'), - ), - ] diff --git a/sapl/comissoes/models.py b/sapl/comissoes/models.py index 4483dd07a..a21a20508 100644 --- a/sapl/comissoes/models.py +++ b/sapl/comissoes/models.py @@ -32,7 +32,9 @@ class TipoComissao(models.Model): @reversion.register() class Comissao(models.Model): - tipo = models.ForeignKey(TipoComissao, verbose_name=_('Tipo')) + tipo = models.ForeignKey(TipoComissao, + on_delete=models.PROTECT, + verbose_name=_('Tipo')) nome = models.CharField(max_length=60, verbose_name=_('Nome')) sigla = models.CharField(max_length=10, verbose_name=_('Sigla')) data_criacao = models.DateField(verbose_name=_('Data de Criação')) @@ -132,8 +134,12 @@ class CargoComissao(models.Model): @reversion.register() class Composicao(models.Model): # IGNORE - comissao = models.ForeignKey(Comissao, verbose_name=_('Comissão')) - periodo = models.ForeignKey(Periodo, verbose_name=_('Período')) + comissao = models.ForeignKey(Comissao, + on_delete=models.PROTECT, + verbose_name=_('Comissão')) + periodo = models.ForeignKey(Periodo, + on_delete=models.PROTECT, + verbose_name=_('Período')) class Meta: verbose_name = _('Composição de Comissão') @@ -145,9 +151,11 @@ class Composicao(models.Model): # IGNORE @reversion.register() class Participacao(models.Model): # ComposicaoComissao - composicao = models.ForeignKey(Composicao, related_name='participacao_set') - parlamentar = models.ForeignKey(Parlamentar) - cargo = models.ForeignKey(CargoComissao) + composicao = models.ForeignKey(Composicao, + related_name='participacao_set', + on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) + cargo = models.ForeignKey(CargoComissao, on_delete=models.PROTECT) titular = models.BooleanField( verbose_name=_('Titular'), default=False, diff --git a/sapl/compilacao/migrations/0001_initial.py b/sapl/compilacao/migrations/0001_initial.py index fe763b7f0..8d504bf15 100644 --- a/sapl/compilacao/migrations/0001_initial.py +++ b/sapl/compilacao/migrations/0001_initial.py @@ -1,50 +1,57 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): + initial = True + dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('norma', '0003_auto_20150906_0239'), + ('contenttypes', '0002_remove_content_type_name'), ] operations = [ migrations.CreateModel( name='Dispositivo', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('ordem', models.PositiveIntegerField(verbose_name='Ordem de Renderização', default=0)), - ('ordem_bloco_atualizador', models.PositiveIntegerField(verbose_name='Ordem de Renderização no Bloco Atualizador', default=0)), - ('nivel', models.PositiveIntegerField(blank=True, null=True, verbose_name='Nível Estrutural', default=0)), - ('dispositivo0', models.PositiveIntegerField(verbose_name='Número do Dispositivo', default=0)), - ('dispositivo1', models.PositiveIntegerField(blank=True, null=True, verbose_name='Primeiro Nível de Variação', default=0)), - ('dispositivo2', models.PositiveIntegerField(blank=True, null=True, verbose_name='Segundo Nível de Variação', default=0)), - ('dispositivo3', models.PositiveIntegerField(blank=True, null=True, verbose_name='Terceiro Nível de Variação', default=0)), - ('dispositivo4', models.PositiveIntegerField(blank=True, null=True, verbose_name='Quarto Nível de Variação', default=0)), - ('dispositivo5', models.PositiveIntegerField(blank=True, null=True, verbose_name='Quinto Nível de Variação', default=0)), - ('rotulo', models.CharField(blank=True, max_length=50, verbose_name='Rótulo', default='')), - ('texto', models.TextField(blank=True, verbose_name='Texto', default='')), - ('texto_atualizador', models.TextField(blank=True, verbose_name='Texto no Dispositivo Atualizador', default='')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('ordem', models.PositiveIntegerField(default=0, verbose_name='Ordem de Renderização')), + ('ordem_bloco_atualizador', models.PositiveIntegerField(default=0, verbose_name='Ordem de Renderização no Bloco Atualizador')), + ('nivel', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Nível Estrutural')), + ('dispositivo0', models.PositiveIntegerField(default=0, verbose_name='Número do Dispositivo')), + ('dispositivo1', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Primeiro Nível de Variação')), + ('dispositivo2', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Segundo Nível de Variação')), + ('dispositivo3', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Terceiro Nível de Variação')), + ('dispositivo4', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Quarto Nível de Variação')), + ('dispositivo5', models.PositiveIntegerField(blank=True, default=0, null=True, verbose_name='Quinto Nível de Variação')), + ('rotulo', models.CharField(blank=True, default='', max_length=50, verbose_name='Rótulo')), + ('texto', models.TextField(blank=True, default='', verbose_name='Texto do Dispositivo')), + ('texto_atualizador', models.TextField(blank=True, default='', verbose_name='Texto do Dispositivo no Dispositivo Atualizador')), ('inicio_vigencia', models.DateField(verbose_name='Início de Vigência')), ('fim_vigencia', models.DateField(blank=True, null=True, verbose_name='Fim de Vigência')), ('inicio_eficacia', models.DateField(verbose_name='Início de Eficácia')), ('fim_eficacia', models.DateField(blank=True, null=True, verbose_name='Fim de Eficácia')), - ('inconstitucionalidade', models.BooleanField(verbose_name='Inconstitucionalidade', default=False, choices=[(True, 'Sim'), (False, 'Não')])), - ('visibilidade', models.BooleanField(verbose_name='Visibilidade na Norma Publicada', default=False, choices=[(True, 'Sim'), (False, 'Não')])), - ('timestamp', models.DateTimeField()), - ('dispositivo_atualizador', models.ForeignKey(blank=True, null=True, to='compilacao.Dispositivo', verbose_name='Dispositivo Atualizador', default=None, related_name='dispositivo_dispositivo_atualizador')), - ('dispositivo_pai', models.ForeignKey(blank=True, null=True, to='compilacao.Dispositivo', verbose_name='Dispositivo Pai', default=None, related_name='dispositivo_dispositivo_pai')), - ('dispositivo_subsequente', models.ForeignKey(blank=True, null=True, to='compilacao.Dispositivo', verbose_name='Dispositivo Subsequente', default=None, related_name='dispositivo_dispositivo_subsequente')), - ('dispositivo_substituido', models.ForeignKey(blank=True, null=True, to='compilacao.Dispositivo', verbose_name='Dispositivo Substituido', default=None, related_name='dispositivo_dispositivo_substituido')), - ('dispositivo_vigencia', models.ForeignKey(blank=True, null=True, to='compilacao.Dispositivo', verbose_name='Dispositivo de Vigência', default=None, related_name='dispositivo_dispositivo_vigencia')), - ('norma', models.ForeignKey(to='norma.NormaJuridica', verbose_name='Norma Jurídica')), - ('norma_publicada', models.ForeignKey(blank=True, null=True, to='norma.NormaJuridica', verbose_name='Norma Jurídica Publicada', default=None, related_name='dispositivo_norma_publicada')), + ('inconstitucionalidade', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Declarado Inconstitucional')), + ('auto_inserido', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Auto Inserido')), + ('visibilidade', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Visibilidade no Texto Articulado Publicado')), + ('dispositivo_de_revogacao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Dispositivo de Revogação')), + ('dispositivo_atualizador', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dispositivos_alterados_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Atualizador')), + ('dispositivo_pai', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dispositivos_filhos_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Pai')), + ('dispositivo_subsequente', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_subsequente_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Subsequente')), + ('dispositivo_substituido', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_substituido_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Substituido')), + ('dispositivo_vigencia', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivos_vigencias_set', to='compilacao.Dispositivo', verbose_name='Dispositivo de Vigência')), ], options={ + 'permissions': (('change_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico.'), ('change_your_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico desde que seja dono.'), ('change_dispositivo_edicao_avancada', 'Permissão de edição de dispositivos originais via formulários de edição avançada.'), ('change_dispositivo_registros_compilacao', 'Permissão de registro de compilação via editor dinâmico.'), ('view_dispositivo_notificacoes', 'Permissão de acesso às notificações de pendências.'), ('change_dispositivo_de_vigencia_global', 'Permissão alteração global do dispositivo de vigência')), + 'ordering': ['ta', 'ordem'], 'verbose_name': 'Dispositivo', 'verbose_name_plural': 'Dispositivos', }, @@ -52,70 +59,143 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Nota', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('texto', models.TextField(verbose_name='Texto da Nota')), - ('url_externa', models.CharField(blank=True, max_length=1024, verbose_name='Url externa')), - ('data_criacao', models.DateTimeField(verbose_name='Data de Criação')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('titulo', models.CharField(blank=True, default='', max_length=100, verbose_name='Título')), + ('texto', models.TextField(verbose_name='Texto')), + ('url_externa', models.URLField(blank=True, max_length=1024, verbose_name='Url externa')), ('publicacao', models.DateTimeField(verbose_name='Data de Publicação')), - ('efetifidade', models.DateTimeField(verbose_name='Data de Efeito')), - ('publicidade', models.PositiveSmallIntegerField(verbose_name='Nível de Publicidade', choices=[(1, 'Nota Privada'), (2, 'Nota Setorial'), (3, 'Nota Institucional'), (4, 'Nota Pública')])), - ('dispositivo', models.ForeignKey(to='compilacao.Dispositivo', verbose_name='Dispositivo da Nota')), - ('owner', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='Dono da Nota')), + ('efetividade', models.DateTimeField(verbose_name='Data de Efeito')), + ('publicidade', models.PositiveSmallIntegerField(choices=[(1, 'Nota Privada'), (2, 'Nota Institucional'), (3, 'Nota Pública')], verbose_name='Nível de Publicidade')), + ('dispositivo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_nota_set', to='compilacao.Dispositivo', verbose_name='Dispositivo da Nota')), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Dono da Nota')), ], options={ + 'ordering': ['-publicacao', '-modified'], 'verbose_name': 'Nota', 'verbose_name_plural': 'Notas', }, ), + migrations.CreateModel( + name='PerfilEstruturalTextoArticulado', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=10, unique=True, verbose_name='Sigla')), + ('nome', models.CharField(max_length=50, verbose_name='Nome')), + ('padrao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Padrão')), + ('parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='perfil_parent_set', to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfil Herdado')), + ], + options={ + 'ordering': ['-padrao', 'sigla'], + 'verbose_name': 'Perfil Estrutural de Texto Articulado', + 'verbose_name_plural': 'Perfis Estruturais de Textos Articulados', + }, + ), migrations.CreateModel( name='Publicacao', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('publicacao', models.DateTimeField(verbose_name='Data de Publicação')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('data', models.DateField(verbose_name='Data de Publicação')), + ('hora', models.TimeField(blank=True, null=True, verbose_name='Horário de Publicação')), + ('numero', models.PositiveIntegerField(blank=True, null=True, verbose_name='Número')), + ('ano', models.PositiveIntegerField(blank=True, null=True, verbose_name='Ano')), + ('edicao', models.PositiveIntegerField(blank=True, null=True, verbose_name='Edição')), + ('url_externa', models.URLField(blank=True, max_length=1024, verbose_name='Link para Versão Eletrônica')), ('pagina_inicio', models.PositiveIntegerField(blank=True, null=True, verbose_name='Pg. Início')), ('pagina_fim', models.PositiveIntegerField(blank=True, null=True, verbose_name='Pg. Fim')), - ('timestamp', models.DateTimeField()), - ('norma', models.ForeignKey(to='norma.NormaJuridica', verbose_name='Norma Jurídica')), ], options={ 'verbose_name': 'Publicação', 'verbose_name_plural': 'Publicações', }, ), + migrations.CreateModel( + name='TextoArticulado', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('data', models.DateField(blank=True, null=True, verbose_name='Data')), + ('ementa', models.TextField(verbose_name='Ementa')), + ('observacao', models.TextField(blank=True, verbose_name='Observação')), + ('numero', models.PositiveIntegerField(verbose_name='Número')), + ('ano', models.PositiveSmallIntegerField(verbose_name='Ano')), + ('participacao_social', models.NullBooleanField(choices=[(None, 'Padrão definido no Tipo'), (True, 'Sim'), (False, 'Não')], default=None, verbose_name='Participação Social')), + ('object_id', models.PositiveIntegerField(blank=True, default=None, null=True)), + ('editable_only_by_owners', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Editável apenas pelos donos do Texto Articulado')), + ('editing_locked', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Texto Articulado em Edição')), + ('privacidade', models.IntegerField(choices=[(99, 'Privado'), (79, 'Imotável Restrito'), (69, 'Imutável Público'), (89, 'Em Edição'), (0, 'Público')], default=99, verbose_name='Privacidade')), + ('content_type', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ('owners', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Donos do Texto Articulado')), + ], + options={ + 'permissions': (('view_restricted_textoarticulado', 'Pode ver qualquer Texto Articulado'), ('lock_unlock_textoarticulado', 'Pode bloquear/desbloquear edição de Texto Articulado')), + 'ordering': ['-data', '-numero'], + 'verbose_name': 'Texto Articulado', + 'verbose_name_plural': 'Textos Articulados', + }, + ), migrations.CreateModel( name='TipoDispositivo', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('nome', models.CharField(max_length=50, verbose_name='Nome', unique=True)), - ('class_css', models.CharField(max_length=20, verbose_name='Classe CSS')), - ('rotulo_prefixo_html', models.CharField(blank=True, max_length=100, verbose_name='Prefixo html do rótulo')), - ('rotulo_prefixo_texto', models.CharField(blank=True, max_length=30, verbose_name='Prefixo de construção do rótulo')), - ('rotulo_ordinal', models.IntegerField(verbose_name='Tipo de número do rótulo')), - ('rotulo_separadores_variacao', models.CharField(blank=True, max_length=5, verbose_name='Separadores das Variações')), - ('rotulo_sufixo_texto', models.CharField(blank=True, max_length=30, verbose_name='Sufixo de construção do rótulo')), - ('rotulo_sufixo_html', models.CharField(blank=True, max_length=100, verbose_name='Sufixo html do rótulo')), - ('texto_prefixo_html', models.CharField(blank=True, max_length=100, verbose_name='Prefixo html do texto')), - ('texto_sufixo_html', models.CharField(blank=True, max_length=100, verbose_name='Sufixo html do texto')), - ('nota_automatica_prefixo_html', models.CharField(blank=True, max_length=100, verbose_name='Prefixo html da nota automática')), - ('nota_automatica_sufixo_html', models.CharField(blank=True, max_length=100, verbose_name='Sufixo html da nota automática')), - ('contagem_continua', models.BooleanField(verbose_name='Contagem contínua', choices=[(True, 'Sim'), (False, 'Não')])), - ('formato_variacao0', models.CharField(max_length=1, verbose_name='Formato da Numeração', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), - ('formato_variacao1', models.CharField(max_length=1, verbose_name='Formato da Variação 1', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), - ('formato_variacao2', models.CharField(max_length=1, verbose_name='Formato da Variação 2', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), - ('formato_variacao3', models.CharField(max_length=1, verbose_name='Formato da Variação 3', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), - ('formato_variacao4', models.CharField(max_length=1, verbose_name='Formato da Variação 4', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), - ('formato_variacao5', models.CharField(max_length=1, verbose_name='Formato da Variação 5', default='1', choices=[('1', '(1) Numérico'), ('I', '(I) Romano Maiúsculo'), ('i', '(i) Romano Minúsculo'), ('A', '(A) Alfabético Maiúsculo'), ('a', '(a) Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')])), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(max_length=50, unique=True, verbose_name='Nome')), + ('class_css', models.CharField(blank=True, max_length=20, verbose_name='Classe CSS')), + ('rotulo_prefixo_html', models.TextField(blank=True, verbose_name='Prefixo html do rótulo')), + ('rotulo_prefixo_texto', models.TextField(blank=True, verbose_name='Prefixo de Edição do rótulo')), + ('rotulo_ordinal', models.IntegerField(choices=[(0, 'Numeração Cardinal.'), (-1, 'Numeração Ordinal.'), (9, 'Numeração Ordinal até o item nove.')], verbose_name='Tipo de número do rótulo')), + ('rotulo_separador_variacao01', models.CharField(default='-', max_length=1, verbose_name='Separador entre Numeração e Variação 1')), + ('rotulo_separador_variacao12', models.CharField(default='-', max_length=1, verbose_name='Separador entre Variação 1 e Variação 2')), + ('rotulo_separador_variacao23', models.CharField(default='-', max_length=1, verbose_name='Separador entre Variação 2 e Variação 3')), + ('rotulo_separador_variacao34', models.CharField(default='-', max_length=1, verbose_name='Separador entre Variação 3 e Variação 4')), + ('rotulo_separador_variacao45', models.CharField(default='-', max_length=1, verbose_name='Separador entre Variação 4 e Variação 5')), + ('rotulo_sufixo_texto', models.TextField(blank=True, verbose_name='Sufixo de Edição do rótulo')), + ('rotulo_sufixo_html', models.TextField(blank=True, verbose_name='Sufixo html do rótulo')), + ('texto_prefixo_html', models.TextField(blank=True, verbose_name='Prefixo html do texto')), + ('texto_sufixo_html', models.TextField(blank=True, verbose_name='Sufixo html do texto')), + ('nota_automatica_prefixo_html', models.TextField(blank=True, verbose_name='Prefixo html da nota automática')), + ('nota_automatica_sufixo_html', models.TextField(blank=True, verbose_name='Sufixo html da nota automática')), + ('contagem_continua', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Contagem contínua')), + ('dispositivo_de_articulacao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Dispositivo de Articulação (Sem Texto)')), + ('dispositivo_de_alteracao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Dispositivo de Alteração')), + ('formato_variacao0', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Numeração')), + ('formato_variacao1', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Variação 1')), + ('formato_variacao2', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Variação 2')), + ('formato_variacao3', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Variação 3')), + ('formato_variacao4', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Variação 4')), + ('formato_variacao5', models.CharField(choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], default='1', max_length=1, verbose_name='Formato da Variação 5')), ], options={ + 'ordering': ['id'], 'verbose_name': 'Tipo de Dispositivo', 'verbose_name_plural': 'Tipos de Dispositivo', }, ), + migrations.CreateModel( + name='TipoDispositivoRelationship', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('filho_de_insercao_automatica', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Filho de Inserção Automática')), + ('permitir_variacao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Permitir Variação Numérica')), + ('quantidade_permitida', models.IntegerField(default=-1, verbose_name='Quantidade permitida nesta relação')), + ('filho_permitido', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='possiveis_pais', to='compilacao.TipoDispositivo')), + ('pai', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='filhos_permitidos', to='compilacao.TipoDispositivo')), + ('perfil', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.PerfilEstruturalTextoArticulado')), + ], + options={ + 'ordering': ['pai', 'filho_permitido'], + 'verbose_name': 'Relação Direta Permitida', + 'verbose_name_plural': 'Relaçõe Diretas Permitidas', + }, + ), migrations.CreateModel( name='TipoNota', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('sigla', models.CharField(max_length=10, verbose_name='Sigla', unique=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=10, unique=True, verbose_name='Sigla')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('modelo', models.TextField(blank=True, verbose_name='Modelo')), ], @@ -127,8 +207,8 @@ class Migration(migrations.Migration): migrations.CreateModel( name='TipoPublicacao', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('sigla', models.CharField(max_length=10, verbose_name='Sigla', unique=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=10, unique=True, verbose_name='Sigla')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ], options={ @@ -136,11 +216,27 @@ class Migration(migrations.Migration): 'verbose_name_plural': 'Tipos de Publicação', }, ), + migrations.CreateModel( + name='TipoTextoArticulado', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=3, verbose_name='Sigla')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), + ('participacao_social', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Participação Social')), + ('publicacao_func', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Histórico de Publicação')), + ('content_type', models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Modelo Integrado')), + ('perfis', models.ManyToManyField(blank=True, help_text='\n Apenas os perfis selecionados aqui estarão disponíveis\n para o editor de Textos Articulados cujo Tipo seja este\n em edição.\n ', to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfis Estruturais de Textos Articulados')), + ], + options={ + 'verbose_name': 'Tipo de Texto Articulado', + 'verbose_name_plural': 'Tipos de Texto Articulados', + }, + ), migrations.CreateModel( name='TipoVide', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('sigla', models.CharField(max_length=10, verbose_name='Sigla', unique=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=10, unique=True, verbose_name='Sigla')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ], options={ @@ -151,8 +247,8 @@ class Migration(migrations.Migration): migrations.CreateModel( name='VeiculoPublicacao', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('sigla', models.CharField(max_length=10, verbose_name='Sigla', unique=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(max_length=10, unique=True, verbose_name='Sigla')), ('nome', models.CharField(max_length=60, verbose_name='Nome')), ], options={ @@ -163,45 +259,79 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Vide', fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('data_criacao', models.DateTimeField(verbose_name='Data de Criação')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), ('texto', models.TextField(verbose_name='Texto do Vide')), - ('dispositivo_base', models.ForeignKey(to='compilacao.Dispositivo', verbose_name='Dispositivo Base', related_name='vide_dispositivo_base')), - ('dispositivo_ref', models.ForeignKey(to='compilacao.Dispositivo', verbose_name='Dispositivo Referido', related_name='vide_dispositivo_ref')), - ('tipo', models.ForeignKey(to='compilacao.TipoVide', verbose_name='Tipo do Vide')), + ('dispositivo_base', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_base_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Base')), + ('dispositivo_ref', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_citado_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Referido')), + ('tipo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.TipoVide', verbose_name='Tipo do Vide')), ], options={ 'verbose_name': 'Vide', 'verbose_name_plural': 'Vides', }, ), + migrations.AddField( + model_name='tipodispositivo', + name='relacoes_diretas_pai_filho', + field=models.ManyToManyField(related_name='relacaoes_pai_filho', through='compilacao.TipoDispositivoRelationship', to='compilacao.TipoDispositivo'), + ), + migrations.AddField( + model_name='textoarticulado', + name='tipo_ta', + field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='compilacao.TipoTextoArticulado', verbose_name='Tipo de Texto Articulado'), + ), + migrations.AddField( + model_name='publicacao', + name='ta', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), + ), migrations.AddField( model_name='publicacao', name='tipo_publicacao', - field=models.ForeignKey(to='compilacao.TipoPublicacao', verbose_name='Tipo de Publicação'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.TipoPublicacao', verbose_name='Tipo de Publicação'), ), migrations.AddField( model_name='publicacao', name='veiculo_publicacao', - field=models.ForeignKey(to='compilacao.VeiculoPublicacao', verbose_name='Veículo de Publicação'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.VeiculoPublicacao', verbose_name='Veículo de Publicação'), ), migrations.AddField( model_name='nota', name='tipo', - field=models.ForeignKey(to='compilacao.TipoNota', verbose_name='Tipo da Nota'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='compilacao.TipoNota', verbose_name='Tipo da Nota'), ), migrations.AddField( model_name='dispositivo', name='publicacao', - field=models.ForeignKey(blank=True, null=True, to='compilacao.Publicacao', verbose_name='Publicação', default=None), + field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='compilacao.Publicacao', verbose_name='Publicação'), + ), + migrations.AddField( + model_name='dispositivo', + name='ta', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivos_set', to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), + ), + migrations.AddField( + model_name='dispositivo', + name='ta_publicado', + field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='dispositivos_alterados_pelo_ta_set', to='compilacao.TextoArticulado', verbose_name='Texto Articulado Publicado'), ), migrations.AddField( model_name='dispositivo', name='tipo_dispositivo', - field=models.ForeignKey(to='compilacao.TipoDispositivo', verbose_name='Tipo do Dispositivo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='dispositivos_do_tipo_set', to='compilacao.TipoDispositivo', verbose_name='Tipo do Dispositivo'), + ), + migrations.AlterUniqueTogether( + name='vide', + unique_together=set([('dispositivo_base', 'dispositivo_ref', 'tipo')]), + ), + migrations.AlterUniqueTogether( + name='tipodispositivorelationship', + unique_together=set([('pai', 'filho_permitido', 'perfil')]), ), migrations.AlterUniqueTogether( name='dispositivo', - unique_together=set([('norma', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'publicacao'), ('norma', 'ordem')]), + unique_together=set([('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'dispositivo_atualizador', 'ta_publicado', 'publicacao'), ('ta', 'ordem')]), ), ] diff --git a/sapl/compilacao/migrations/0002_auto_20150907_2334.py b/sapl/compilacao/migrations/0002_auto_20150907_2334.py deleted file mode 100644 index da10519c5..000000000 --- a/sapl/compilacao/migrations/0002_auto_20150907_2334.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0001_initial'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['norma', 'ordem'], 'verbose_name_plural': 'Dispositivos', 'verbose_name': 'Dispositivo'}, - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_atualizador', - field=models.ForeignKey(related_name='dispositivos_alterados_set', to='compilacao.Dispositivo', null=True, verbose_name='Dispositivo Atualizador', default=None, blank=True), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_pai', - field=models.ForeignKey(related_name='+', to='compilacao.Dispositivo', null=True, verbose_name='Dispositivo Pai', default=None, blank=True), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_subsequente', - field=models.ForeignKey(related_name='+', to='compilacao.Dispositivo', null=True, verbose_name='Dispositivo Subsequente', default=None, blank=True), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_substituido', - field=models.ForeignKey(related_name='+', to='compilacao.Dispositivo', null=True, verbose_name='Dispositivo Substituido', default=None, blank=True), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_vigencia', - field=models.ForeignKey(related_name='+', to='compilacao.Dispositivo', null=True, verbose_name='Dispositivo de Vigência', default=None, blank=True), - ), - migrations.AlterField( - model_name='dispositivo', - name='norma_publicada', - field=models.ForeignKey(related_name='dispositivos_alterados_set', to='norma.NormaJuridica', null=True, verbose_name='Norma Jurídica Publicada', default=None, blank=True), - ), - ] diff --git a/sapl/compilacao/migrations/0003_auto_20150911_1735.py b/sapl/compilacao/migrations/0003_auto_20150911_1735.py deleted file mode 100644 index 67ae645a6..000000000 --- a/sapl/compilacao/migrations/0003_auto_20150911_1735.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0002_auto_20150907_2334'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_pai', - field=models.ForeignKey(blank=True, null=True, verbose_name='Dispositivo Pai', to='compilacao.Dispositivo', related_name='filhos', default=None), - ), - ] diff --git a/sapl/compilacao/migrations/0004_auto_20150914_0842.py b/sapl/compilacao/migrations/0004_auto_20150914_0842.py deleted file mode 100644 index a871bcc07..000000000 --- a/sapl/compilacao/migrations/0004_auto_20150914_0842.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0003_auto_20150911_1735'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_pai', - field=models.ForeignKey(to='compilacao.Dispositivo', verbose_name='Dispositivo Pai', blank=True, related_name='dispositivos_filhos_set', null=True, default=None), - ), - migrations.AlterField( - model_name='dispositivo', - name='norma', - field=models.ForeignKey(related_name='dispositivos_set', to='norma.NormaJuridica', verbose_name='Norma Jurídica'), - ), - migrations.AlterField( - model_name='dispositivo', - name='norma_publicada', - field=models.ForeignKey(to='norma.NormaJuridica', verbose_name='Norma Jurídica Publicada', blank=True, related_name='dispositivos_alterados_pela_norma_set', null=True, default=None), - ), - migrations.AlterField( - model_name='dispositivo', - name='tipo_dispositivo', - field=models.ForeignKey(related_name='dispositivos_do_tipo_set', to='compilacao.TipoDispositivo', verbose_name='Tipo do Dispositivo'), - ), - ] diff --git a/sapl/compilacao/migrations/0005_auto_20150924_1012.py b/sapl/compilacao/migrations/0005_auto_20150924_1012.py deleted file mode 100644 index 3e4dbe625..000000000 --- a/sapl/compilacao/migrations/0005_auto_20150924_1012.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0004_auto_20150914_0842'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tipodispositivo', - options={'verbose_name_plural': 'Tipos de Dispositivo', 'verbose_name': 'Tipo de Dispositivo', 'ordering': ['id']}, - ), - migrations.RemoveField( - model_name='tipodispositivo', - name='rotulo_separadores_variacao', - ), - migrations.AddField( - model_name='tipodispositivo', - name='rotulo_separador_variacao01', - field=models.CharField(max_length=1, default='-', verbose_name='Separadores entre Numeração e Variação 1', blank=True), - ), - migrations.AddField( - model_name='tipodispositivo', - name='rotulo_separador_variacao12', - field=models.CharField(max_length=1, default='-', verbose_name='Separadores entre Variação 1 e Variação 2', blank=True), - ), - migrations.AddField( - model_name='tipodispositivo', - name='rotulo_separador_variacao23', - field=models.CharField(max_length=1, default='-', verbose_name='Separadores entre Variação 2 e Variação 3', blank=True), - ), - migrations.AddField( - model_name='tipodispositivo', - name='rotulo_separador_variacao34', - field=models.CharField(max_length=1, default='-', verbose_name='Separadores entre Variação 3 e Variação 4', blank=True), - ), - migrations.AddField( - model_name='tipodispositivo', - name='rotulo_separador_variacao45', - field=models.CharField(max_length=1, default='-', verbose_name='Separadores entre Variação 4 e Variação 5', blank=True), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao0', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Numeração'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao1', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Variação 1'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao2', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Variação 2'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao3', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Variação 3'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao4', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Variação 4'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='formato_variacao5', - field=models.CharField(max_length=1, default='1', choices=[('1', '1-Numérico'), ('I', 'I-Romano Maiúsculo'), ('i', 'i-Romano Minúsculo'), ('A', 'A-Alfabético Maiúsculo'), ('a', 'a-Alfabético Minúsculo'), ('*', 'Tópico - Sem contagem'), ('N', 'Sem renderização')], verbose_name='Formato da Variação 5'), - ), - ] diff --git a/sapl/compilacao/migrations/0006_auto_20150924_1121.py b/sapl/compilacao/migrations/0006_auto_20150924_1121.py deleted file mode 100644 index a27cddf2b..000000000 --- a/sapl/compilacao/migrations/0006_auto_20150924_1121.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0005_auto_20150924_1012'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_ordinal', - field=models.IntegerField(choices=[(-1, 'Numeração Cardinal.'), (0, 'Numeração Ordinal.'), (9, 'Numeração Ordinal até o item nove.')], verbose_name='Tipo de número do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_prefixo_texto', - field=models.CharField(blank=True, max_length=30, verbose_name='Prefixo de Edição do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao01', - field=models.CharField(blank=True, default='-', max_length=1, verbose_name='Separador entre Numeração e Variação 1'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao12', - field=models.CharField(blank=True, default='-', max_length=1, verbose_name='Separador entre Variação 1 e Variação 2'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao23', - field=models.CharField(blank=True, default='-', max_length=1, verbose_name='Separador entre Variação 2 e Variação 3'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao34', - field=models.CharField(blank=True, default='-', max_length=1, verbose_name='Separador entre Variação 3 e Variação 4'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao45', - field=models.CharField(blank=True, default='-', max_length=1, verbose_name='Separador entre Variação 4 e Variação 5'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_sufixo_texto', - field=models.CharField(blank=True, max_length=30, verbose_name='Sufixo de Edição do rótulo'), - ), - ] diff --git a/sapl/compilacao/migrations/0007_auto_20150924_1131.py b/sapl/compilacao/migrations/0007_auto_20150924_1131.py deleted file mode 100644 index 56d0bcc25..000000000 --- a/sapl/compilacao/migrations/0007_auto_20150924_1131.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0006_auto_20150924_1121'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='class_css', - field=models.CharField(max_length=20, blank=True, verbose_name='Classe CSS'), - ), - ] diff --git a/sapl/compilacao/migrations/0008_auto_20151005_1023.py b/sapl/compilacao/migrations/0008_auto_20151005_1023.py deleted file mode 100644 index 995d4d9e1..000000000 --- a/sapl/compilacao/migrations/0008_auto_20151005_1023.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0007_auto_20150924_1131'), - ] - - operations = [ - migrations.AddField( - model_name='tipodispositivo', - name='dispositivo_de_articulacao', - field=models.BooleanField(verbose_name='Dispositivo de Articulação (Sem Texto)', default=False, choices=[ - (True, 'Sim'), (False, 'Não')]), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao01', - field=models.CharField( - verbose_name='Separador entre Numeração e Variação 1', default='-', max_length=1), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao12', - field=models.CharField( - verbose_name='Separador entre Variação 1 e Variação 2', default='-', max_length=1), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao23', - field=models.CharField( - verbose_name='Separador entre Variação 2 e Variação 3', default='-', max_length=1), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao34', - field=models.CharField( - verbose_name='Separador entre Variação 3 e Variação 4', default='-', max_length=1), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_separador_variacao45', - field=models.CharField( - verbose_name='Separador entre Variação 4 e Variação 5', default='-', max_length=1), - ), - ] diff --git a/sapl/compilacao/migrations/0009_auto_20151007_1635.py b/sapl/compilacao/migrations/0009_auto_20151007_1635.py deleted file mode 100644 index 1fbc966c8..000000000 --- a/sapl/compilacao/migrations/0009_auto_20151007_1635.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0008_auto_20151005_1023'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_ordinal', - field=models.IntegerField(choices=[(0, 'Numeração Cardinal.'), (-1, 'Numeração Ordinal.'), (9, 'Numeração Ordinal até o item nove.')], verbose_name='Tipo de número do rótulo'), - ), - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('norma', 'ordem'), ('norma', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'norma_publicada', 'publicacao')]), - ), - ] diff --git a/sapl/compilacao/migrations/0010_auto_20151105_1532.py b/sapl/compilacao/migrations/0010_auto_20151105_1532.py deleted file mode 100644 index 3a84ae475..000000000 --- a/sapl/compilacao/migrations/0010_auto_20151105_1532.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0009_auto_20151007_1635'), - ] - - operations = [ - migrations.CreateModel( - name='TipoDispositivoRelationship', - fields=[ - ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), - ('filho_permitido', models.ForeignKey(related_name='filho_permitido', to='compilacao.TipoDispositivo')), - ('pai', models.ForeignKey(related_name='pai', to='compilacao.TipoDispositivo')), - ], - options={ - 'abstract': False, - }, - ), - migrations.AddField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(related_name='filhos_permitidos', through='compilacao.TipoDispositivoRelationship', to='compilacao.TipoDispositivo'), - ), - ] diff --git a/sapl/compilacao/migrations/0011_auto_20151105_1540.py b/sapl/compilacao/migrations/0011_auto_20151105_1540.py deleted file mode 100644 index 4c4e0f0f3..000000000 --- a/sapl/compilacao/migrations/0011_auto_20151105_1540.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0010_auto_20151105_1532'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tipodispositivorelationship', - options={'verbose_name': 'Relação Direta Permitida', 'verbose_name_plural': 'Relaçõe Diretas Permitidas', 'ordering': ['pai', 'filho_permitido']}, - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='filho_permitido', - field=models.ForeignKey(null=True, to='compilacao.TipoDispositivo', blank=True, default=None, related_name='filho_permitido'), - ), - migrations.AlterUniqueTogether( - name='tipodispositivorelationship', - unique_together=set([('pai', 'filho_permitido')]), - ), - ] diff --git a/sapl/compilacao/migrations/0012_auto_20151105_1658.py b/sapl/compilacao/migrations/0012_auto_20151105_1658.py deleted file mode 100644 index 5ac6c1788..000000000 --- a/sapl/compilacao/migrations/0012_auto_20151105_1658.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0011_auto_20151105_1540'), - ] - - operations = [ - migrations.AddField( - model_name='tipodispositivorelationship', - name='filho_de_insercao_automatica', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Filho de Inserção Automática'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(to='compilacao.TipoDispositivo', related_name='possiveis_pais', through='compilacao.TipoDispositivoRelationship'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='filho_permitido', - field=models.ForeignKey(blank=True, default=None, null=True, related_name='pais', to='compilacao.TipoDispositivo'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='pai', - field=models.ForeignKey(to='compilacao.TipoDispositivo', related_name='filhos_permitidos'), - ), - ] diff --git a/sapl/compilacao/migrations/0013_auto_20151106_1843.py b/sapl/compilacao/migrations/0013_auto_20151106_1843.py deleted file mode 100644 index 5786877e7..000000000 --- a/sapl/compilacao/migrations/0013_auto_20151106_1843.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0012_auto_20151105_1658'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(to='compilacao.TipoDispositivo', related_name='_relacoes_diretas_pai_filho_+', through='compilacao.TipoDispositivoRelationship'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='filho_permitido', - field=models.ForeignKey(null=True, blank=True, related_name='possiveis_pais', to='compilacao.TipoDispositivo', default=None), - ), - ] diff --git a/sapl/compilacao/migrations/0014_auto_20151107_1836.py b/sapl/compilacao/migrations/0014_auto_20151107_1836.py deleted file mode 100644 index 1e1cf3138..000000000 --- a/sapl/compilacao/migrations/0014_auto_20151107_1836.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0013_auto_20151106_1843'), - ] - - operations = [ - migrations.AddField( - model_name='tipodispositivo', - name='quantidade_permitida', - field=models.IntegerField(default=-1, verbose_name='Quantidade permitida dentro de uma Norma'), - ), - ] diff --git a/sapl/compilacao/migrations/0015_auto_20151115_2310.py b/sapl/compilacao/migrations/0015_auto_20151115_2310.py deleted file mode 100644 index e0ec8b9e6..000000000 --- a/sapl/compilacao/migrations/0015_auto_20151115_2310.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0014_auto_20151107_1836'), - ] - - operations = [ - migrations.AddField( - model_name='tipodispositivo', - name='dispositivo_de_alteracao', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Dispositivo de Alteração'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='filho_permitido', - field=models.ForeignKey(related_name='possiveis_pais', to='compilacao.TipoDispositivo'), - ), - ] diff --git a/sapl/compilacao/migrations/0016_auto_20151119_0950.py b/sapl/compilacao/migrations/0016_auto_20151119_0950.py deleted file mode 100644 index 807940b86..000000000 --- a/sapl/compilacao/migrations/0016_auto_20151119_0950.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0015_auto_20151115_2310'), - ] - - operations = [ - migrations.CreateModel( - name='PerfilEstruturalTextosNormativos', - fields=[ - ('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')), - ('nome', models.CharField(max_length=50, verbose_name='Nome')), - ], - options={ - 'verbose_name_plural': 'Perfis Estruturais de Textos Normativos', - 'verbose_name': 'Perfil Estrutural de Textos Normativos', - }, - ), - migrations.RemoveField( - model_name='dispositivo', - name='timestamp', - ), - migrations.AddField( - model_name='dispositivo', - name='created', - field=models.DateTimeField(default=datetime.datetime(2015, 11, 19, 11, 49, 55, 455058, tzinfo=utc), auto_now_add=True, verbose_name='created'), - preserve_default=False, - ), - migrations.AddField( - model_name='dispositivo', - name='modified', - field=models.DateTimeField(auto_now=True, default=datetime.datetime(2015, 11, 19, 11, 50, 5, 86839, tzinfo=utc), verbose_name='modified'), - preserve_default=False, - ), - migrations.AddField( - model_name='tipodispositivorelationship', - name='perfil', - field=models.ForeignKey(blank=True, related_name='+', null=True, default=None, to='compilacao.PerfilEstruturalTextosNormativos'), - ), - ] diff --git a/sapl/compilacao/migrations/0017_auto_20151119_1035.py b/sapl/compilacao/migrations/0017_auto_20151119_1035.py deleted file mode 100644 index 8a902b838..000000000 --- a/sapl/compilacao/migrations/0017_auto_20151119_1035.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0016_auto_20151119_0950'), - ] - - operations = [ - migrations.AddField( - model_name='perfilestruturaltextosnormativos', - name='padrao', - field=models.BooleanField(verbose_name='Padrão', choices=[(True, 'Sim'), (False, 'Não')], default=False), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='perfil', - field=models.ForeignKey(to='compilacao.PerfilEstruturalTextosNormativos'), - ), - migrations.AlterUniqueTogether( - name='tipodispositivorelationship', - unique_together=set([('pai', 'filho_permitido', 'perfil')]), - ), - ] diff --git a/sapl/compilacao/migrations/0018_auto_20151119_1052.py b/sapl/compilacao/migrations/0018_auto_20151119_1052.py deleted file mode 100644 index 00e78daef..000000000 --- a/sapl/compilacao/migrations/0018_auto_20151119_1052.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0017_auto_20151119_1035'), - ] - - operations = [ - migrations.RemoveField( - model_name='tipodispositivo', - name='quantidade_permitida', - ), - migrations.AddField( - model_name='tipodispositivorelationship', - name='quantidade_permitida', - field=models.IntegerField(default=-1, verbose_name='Quantidade permitida nesta relação'), - ), - ] diff --git a/sapl/compilacao/migrations/0019_auto_20151119_1120.py b/sapl/compilacao/migrations/0019_auto_20151119_1120.py deleted file mode 100644 index f5a461faf..000000000 --- a/sapl/compilacao/migrations/0019_auto_20151119_1120.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0018_auto_20151119_1052'), - ] - - operations = [ - migrations.AddField( - model_name='perfilestruturaltextosnormativos', - name='sigla', - field=models.CharField(max_length=10, verbose_name='Sigla', default='LC95'), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0020_auto_20151119_1126.py b/sapl/compilacao/migrations/0020_auto_20151119_1126.py deleted file mode 100644 index d63e4c8d2..000000000 --- a/sapl/compilacao/migrations/0020_auto_20151119_1126.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0019_auto_20151119_1120'), - ] - - operations = [ - migrations.AlterField( - model_name='perfilestruturaltextosnormativos', - name='sigla', - field=models.CharField( - max_length=10, verbose_name='Sigla', unique=True), - ), - ] diff --git a/sapl/compilacao/migrations/0021_auto_20151119_1617.py b/sapl/compilacao/migrations/0021_auto_20151119_1617.py deleted file mode 100644 index e378f4a60..000000000 --- a/sapl/compilacao/migrations/0021_auto_20151119_1617.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0020_auto_20151119_1126'), - ] - - operations = [ - migrations.AlterModelOptions( - name='perfilestruturaltextosnormativos', - options={'verbose_name': 'Perfil Estrutural de Textos Normativos', 'verbose_name_plural': 'Perfis Estruturais de Textos Normativos', 'ordering': ['-padrao', 'sigla']}, - ), - migrations.AddField( - model_name='tipodispositivorelationship', - name='permitir_variacao', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Permitir Variação Numérica', default=True), - ), - ] diff --git a/sapl/compilacao/migrations/0022_auto_20151120_1503.py b/sapl/compilacao/migrations/0022_auto_20151120_1503.py deleted file mode 100644 index 15eee6015..000000000 --- a/sapl/compilacao/migrations/0022_auto_20151120_1503.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0021_auto_20151119_1617'), - ] - - operations = [ - migrations.RemoveField( - model_name='publicacao', - name='timestamp', - ), - migrations.AddField( - model_name='publicacao', - name='created', - field=models.DateTimeField(verbose_name='created', auto_now_add=True, default=datetime.datetime(2015, 11, 20, 17, 3, 45, 347063, tzinfo=utc)), - preserve_default=False, - ), - migrations.AddField( - model_name='publicacao', - name='modified', - field=models.DateTimeField(verbose_name='modified', default=datetime.datetime(2015, 11, 20, 17, 3, 51, 67108, tzinfo=utc), auto_now=True), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0023_auto_20151120_1529.py b/sapl/compilacao/migrations/0023_auto_20151120_1529.py deleted file mode 100644 index 1a78f7212..000000000 --- a/sapl/compilacao/migrations/0023_auto_20151120_1529.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0022_auto_20151120_1503'), - ] - - operations = [ - migrations.AddField( - model_name='vide', - name='created', - field=models.DateTimeField(verbose_name='created', auto_now_add=True, default=datetime.datetime(2015, 11, 20, 17, 29, 27, 32283, tzinfo=utc)), - preserve_default=False, - ), - migrations.AddField( - model_name='vide', - name='modified', - field=models.DateTimeField(verbose_name='modified', auto_now=True, default=datetime.datetime(2015, 11, 20, 17, 29, 31, 856683, tzinfo=utc)), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0024_auto_20151120_1814.py b/sapl/compilacao/migrations/0024_auto_20151120_1814.py deleted file mode 100644 index 47d696f33..000000000 --- a/sapl/compilacao/migrations/0024_auto_20151120_1814.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0023_auto_20151120_1529'), - ] - - operations = [ - migrations.RemoveField( - model_name='nota', - name='data_criacao', - ), - migrations.RemoveField( - model_name='vide', - name='data_criacao', - ), - migrations.AddField( - model_name='nota', - name='created', - field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2015, 11, 20, 20, 13, 57, 385520, tzinfo=utc), verbose_name='created'), - preserve_default=False, - ), - migrations.AddField( - model_name='nota', - name='modified', - field=models.DateTimeField(auto_now=True, default=datetime.datetime(2015, 11, 20, 20, 14, 3, 360297, tzinfo=utc), verbose_name='modified'), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0025_auto_20151122_1744.py b/sapl/compilacao/migrations/0025_auto_20151122_1744.py deleted file mode 100644 index 1b69eb301..000000000 --- a/sapl/compilacao/migrations/0025_auto_20151122_1744.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0024_auto_20151120_1814'), - ] - - operations = [ - migrations.RenameField( - model_name='nota', - old_name='efetifidade', - new_name='efetividade', - ), - migrations.AlterField( - model_name='nota', - name='dispositivo', - field=models.ForeignKey(to='compilacao.Dispositivo', related_name='notas', verbose_name='Dispositivo da Nota'), - ), - ] diff --git a/sapl/compilacao/migrations/0026_auto_20151122_1756.py b/sapl/compilacao/migrations/0026_auto_20151122_1756.py deleted file mode 100644 index 9d75c3f91..000000000 --- a/sapl/compilacao/migrations/0026_auto_20151122_1756.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0025_auto_20151122_1744'), - ] - - operations = [ - migrations.AlterModelOptions( - name='nota', - options={'verbose_name': 'Nota', 'ordering': ['publicacao'], 'verbose_name_plural': 'Notas'}, - ), - migrations.AddField( - model_name='nota', - name='titulo', - field=models.CharField(verbose_name='Título', max_length=100, default=''), - ), - migrations.AlterField( - model_name='nota', - name='texto', - field=models.TextField(verbose_name='Texto'), - ), - ] diff --git a/sapl/compilacao/migrations/0027_auto_20151130_1632.py b/sapl/compilacao/migrations/0027_auto_20151130_1632.py deleted file mode 100644 index 81c64d951..000000000 --- a/sapl/compilacao/migrations/0027_auto_20151130_1632.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0026_auto_20151122_1756'), - ] - - operations = [ - migrations.AlterModelOptions( - name='nota', - options={'verbose_name': 'Nota', 'ordering': ['-publicacao', '-modified'], 'verbose_name_plural': 'Notas'}, - ), - migrations.AlterField( - model_name='nota', - name='titulo', - field=models.CharField(verbose_name='Título', default='', blank=True, max_length=100), - ), - migrations.AlterField( - model_name='vide', - name='dispositivo_base', - field=models.ForeignKey(verbose_name='Dispositivo Base', related_name='cita', to='compilacao.Dispositivo'), - ), - migrations.AlterField( - model_name='vide', - name='dispositivo_ref', - field=models.ForeignKey(verbose_name='Dispositivo Referido', related_name='citado', to='compilacao.Dispositivo'), - ), - ] diff --git a/sapl/compilacao/migrations/0028_auto_20151201_0042.py b/sapl/compilacao/migrations/0028_auto_20151201_0042.py deleted file mode 100644 index 990c31fbc..000000000 --- a/sapl/compilacao/migrations/0028_auto_20151201_0042.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0027_auto_20151130_1632'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='vide', - unique_together=set([('dispositivo_base', 'dispositivo_ref')]), - ), - ] diff --git a/sapl/compilacao/migrations/0029_auto_20151201_1611.py b/sapl/compilacao/migrations/0029_auto_20151201_1611.py deleted file mode 100644 index 34055d72c..000000000 --- a/sapl/compilacao/migrations/0029_auto_20151201_1611.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0028_auto_20151201_0042'), - ] - - operations = [ - migrations.AlterField( - model_name='nota', - name='publicidade', - field=models.PositiveSmallIntegerField(verbose_name='Nível de Publicidade', choices=[(1, 'Nota Privada'), (2, 'Nota Institucional'), (3, 'Nota Pública')]), - ), - ] diff --git a/sapl/compilacao/migrations/0030_auto_20151203_1114.py b/sapl/compilacao/migrations/0030_auto_20151203_1114.py deleted file mode 100644 index 27b47f052..000000000 --- a/sapl/compilacao/migrations/0030_auto_20151203_1114.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0029_auto_20151201_1611'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(to='compilacao.TipoDispositivo', related_name='+', through='compilacao.TipoDispositivoRelationship'), - ), - ] diff --git a/sapl/compilacao/migrations/0030_auto_20151203_1117.py b/sapl/compilacao/migrations/0030_auto_20151203_1117.py deleted file mode 100644 index 4daa1e950..000000000 --- a/sapl/compilacao/migrations/0030_auto_20151203_1117.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0029_auto_20151201_1611'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(to='compilacao.TipoDispositivo', through='compilacao.TipoDispositivoRelationship', related_name='+'), - ), - ] diff --git a/sapl/compilacao/migrations/0031_merge.py b/sapl/compilacao/migrations/0031_merge.py deleted file mode 100644 index 13e743923..000000000 --- a/sapl/compilacao/migrations/0031_merge.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0030_auto_20151203_1114'), - ('compilacao', '0030_auto_20151203_1117'), - ] - - operations = [ - ] diff --git a/sapl/compilacao/migrations/0032_auto_20151213_1538.py b/sapl/compilacao/migrations/0032_auto_20151213_1538.py deleted file mode 100644 index 3bd8555a7..000000000 --- a/sapl/compilacao/migrations/0032_auto_20151213_1538.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0031_merge'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='vide', - unique_together=set( - [('dispositivo_base', 'dispositivo_ref', 'tipo')]), - ), - ] diff --git a/sapl/compilacao/migrations/0033_auto_20151226_1320.py b/sapl/compilacao/migrations/0033_auto_20151226_1320.py deleted file mode 100644 index db1b3b145..000000000 --- a/sapl/compilacao/migrations/0033_auto_20151226_1320.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0032_auto_20151213_1538'), - ] - - operations = [ - migrations.CreateModel( - name='PerfilEstruturalTextoArticulado', - fields=[ - ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), - ('sigla', models.CharField(unique=True, max_length=10, verbose_name='Sigla')), - ('nome', models.CharField(max_length=50, verbose_name='Nome')), - ('padrao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Padrão')), - ], - options={ - 'verbose_name_plural': 'Perfis Estruturais de Textos Articulados', - 'verbose_name': 'Perfil Estrutural de Texto Articulado', - 'ordering': ['-padrao', 'sigla'], - }, - ), - migrations.CreateModel( - name='TextoArticulado', - fields=[ - ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), - ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), - ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), - ('data', models.DateField(null=True, verbose_name='Data', blank=True)), - ('ementa', models.TextField(verbose_name='Ementa')), - ('observacao', models.TextField(null=True, verbose_name='Observação', blank=True)), - ('numero', models.PositiveIntegerField(verbose_name='Número')), - ('ano', models.PositiveSmallIntegerField(verbose_name='Ano')), - ('participacao_social', models.NullBooleanField(choices=[(None, 'Padrão definido no Tipo'), (True, 'Sim'), (False, 'Não')], default=None, verbose_name='Participação Social')), - ], - options={ - 'verbose_name_plural': 'Textos Articulados', - 'verbose_name': 'Texto Articulado', - 'ordering': ['-data', '-numero'], - }, - ), - migrations.CreateModel( - name='TipoTextoArticulado', - fields=[ - ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), - ('sigla', models.CharField(max_length=3, verbose_name='Sigla')), - ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ('participacao_social', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Participação Social')), - ], - options={ - 'verbose_name_plural': 'Tipos de Texto Articulados', - 'verbose_name': 'Tipo de Texto Articulado', - }, - ), - migrations.AlterModelOptions( - name='dispositivo', - options={'verbose_name_plural': 'Dispositivos', 'verbose_name': 'Dispositivo', 'ordering': ['ta', 'ordem']}, - ), - migrations.RemoveField( - model_name='publicacao', - name='norma', - ), - migrations.AlterField( - model_name='dispositivo', - name='visibilidade', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Visibilidade no Texto Articulado Publicado'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='perfil', - field=models.ForeignKey(to='compilacao.PerfilEstruturalTextoArticulado'), - ), - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([]), - ), - migrations.DeleteModel( - name='PerfilEstruturalTextosNormativos', - ), - migrations.AddField( - model_name='textoarticulado', - name='tipo_ta', - field=models.ForeignKey(to='compilacao.TipoTextoArticulado', default=None, blank=True, null=True, verbose_name='Tipo de Texto Articulado'), - ), - migrations.RemoveField( - model_name='dispositivo', - name='norma', - ), - migrations.RemoveField( - model_name='dispositivo', - name='norma_publicada', - ), - migrations.AddField( - model_name='dispositivo', - name='ta', - field=models.ForeignKey(default=1, to='compilacao.TextoArticulado', related_name='dispositivos_set', verbose_name='Texto Articulado'), - preserve_default=False, - ), - migrations.AddField( - model_name='dispositivo', - name='ta_publicado', - field=models.ForeignKey(to='compilacao.TextoArticulado', default=None, blank=True, null=True, related_name='dispositivos_alterados_pelo_ta_set', verbose_name='Texto Articulado Publicado'), - ), - migrations.AddField( - model_name='publicacao', - name='ta', - field=models.ForeignKey(default=1, to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0034_auto_20151226_1321.py b/sapl/compilacao/migrations/0034_auto_20151226_1321.py deleted file mode 100644 index 6f4c8f6d1..000000000 --- a/sapl/compilacao/migrations/0034_auto_20151226_1321.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0033_auto_20151226_1320'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('ta', 'ordem'), ('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'ta_publicado', 'publicacao')]), - ), - ] diff --git a/sapl/compilacao/migrations/0035_auto_20151226_1349.py b/sapl/compilacao/migrations/0035_auto_20151226_1349.py deleted file mode 100644 index ded460760..000000000 --- a/sapl/compilacao/migrations/0035_auto_20151226_1349.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import builtins - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('compilacao', '0034_auto_20151226_1321'), - ] - - operations = [ - migrations.AddField( - model_name='textoarticulado', - name='content_type', - field=models.ForeignKey( - to='contenttypes.ContentType', default=142), - preserve_default=False, - ), - migrations.AddField( - model_name='textoarticulado', - name='object_id', - field=models.PositiveIntegerField(default=1), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0036_auto_20151226_1411.py b/sapl/compilacao/migrations/0036_auto_20151226_1411.py deleted file mode 100644 index 1ae7b9baf..000000000 --- a/sapl/compilacao/migrations/0036_auto_20151226_1411.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0035_auto_20151226_1349'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='content_type', - field=models.ForeignKey(default=None, null=True, to='contenttypes.ContentType', blank=True), - ), - ] diff --git a/sapl/compilacao/migrations/0037_auto_20151226_1414.py b/sapl/compilacao/migrations/0037_auto_20151226_1414.py deleted file mode 100644 index 5420d7917..000000000 --- a/sapl/compilacao/migrations/0037_auto_20151226_1414.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0036_auto_20151226_1411'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='object_id', - field=models.PositiveIntegerField(blank=True, default=None, null=True), - ), - ] diff --git a/sapl/compilacao/migrations/0038_tipotextoarticulado_model.py b/sapl/compilacao/migrations/0038_tipotextoarticulado_model.py deleted file mode 100644 index 561196e71..000000000 --- a/sapl/compilacao/migrations/0038_tipotextoarticulado_model.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0037_auto_20151226_1414'), - ] - - operations = [ - migrations.AddField( - model_name='tipotextoarticulado', - name='model', - field=models.CharField(max_length=50, blank=True, default='', null=True, verbose_name='Modelagem Django'), - ), - ] diff --git a/sapl/compilacao/migrations/0039_auto_20151226_1433.py b/sapl/compilacao/migrations/0039_auto_20151226_1433.py deleted file mode 100644 index 807711408..000000000 --- a/sapl/compilacao/migrations/0039_auto_20151226_1433.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0038_tipotextoarticulado_model'), - ] - - operations = [ - migrations.AlterField( - model_name='tipotextoarticulado', - name='model', - field=models.CharField(verbose_name='Modelagem Django', default='', blank=True, null=True, max_length=50, unique=True), - ), - ] diff --git a/sapl/compilacao/migrations/0040_auto_20160106_1956.py b/sapl/compilacao/migrations/0040_auto_20160106_1956.py deleted file mode 100644 index e621839d6..000000000 --- a/sapl/compilacao/migrations/0040_auto_20160106_1956.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('compilacao', '0039_auto_20151226_1433'), - ] - - operations = [ - migrations.RemoveField( - model_name='tipotextoarticulado', - name='model', - ), - migrations.AddField( - model_name='tipotextoarticulado', - name='content_type', - field=models.ForeignKey(verbose_name='Modelo Integrado', blank=True, default=None, null=True, to='contenttypes.ContentType'), - ), - ] diff --git a/sapl/compilacao/migrations/0041_auto_20160109_1928.py b/sapl/compilacao/migrations/0041_auto_20160109_1928.py deleted file mode 100644 index 9d854832c..000000000 --- a/sapl/compilacao/migrations/0041_auto_20160109_1928.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0040_auto_20160106_1956'), - ] - - operations = [ - migrations.RenameField( - model_name='publicacao', - old_name='publicacao', - new_name='data', - ), - migrations.AddField( - model_name='publicacao', - name='ano', - field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True), - ), - migrations.AddField( - model_name='publicacao', - name='edicao', - field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True), - ), - migrations.AddField( - model_name='publicacao', - name='numero', - field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True), - ), - migrations.AddField( - model_name='publicacao', - name='url_externa', - field=models.CharField(max_length=1024, verbose_name='Link para Versão Eletrônica', blank=True), - ), - ] diff --git a/sapl/compilacao/migrations/0042_auto_20160110_1620.py b/sapl/compilacao/migrations/0042_auto_20160110_1620.py deleted file mode 100644 index 97e2396cc..000000000 --- a/sapl/compilacao/migrations/0042_auto_20160110_1620.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import datetime - -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0041_auto_20160109_1928'), - ] - - operations = [ - migrations.AddField( - model_name='publicacao', - name='hora', - field=models.TimeField(default=datetime.datetime( - 2016, 1, 10, 18, 20, 1, 151209, tzinfo=utc), verbose_name='Horário de Publicação'), - preserve_default=False, - ), - migrations.AlterField( - model_name='publicacao', - name='ano', - field=models.PositiveIntegerField( - verbose_name='Ano', blank=True, null=True), - ), - migrations.AlterField( - model_name='publicacao', - name='data', - field=models.DateField(verbose_name='Data de Publicação'), - ), - migrations.AlterField( - model_name='publicacao', - name='edicao', - field=models.PositiveIntegerField( - verbose_name='Edição', blank=True, null=True), - ), - migrations.AlterField( - model_name='publicacao', - name='numero', - field=models.PositiveIntegerField( - verbose_name='Número', blank=True, null=True), - ), - ] diff --git a/sapl/compilacao/migrations/0043_auto_20160110_1733.py b/sapl/compilacao/migrations/0043_auto_20160110_1733.py deleted file mode 100644 index 94261c8bf..000000000 --- a/sapl/compilacao/migrations/0043_auto_20160110_1733.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0042_auto_20160110_1620'), - ] - - operations = [ - migrations.AlterField( - model_name='publicacao', - name='hora', - field=models.TimeField(null=True, verbose_name='Horário de Publicação', blank=True), - ), - ] diff --git a/sapl/compilacao/migrations/0044_auto_20160307_0918.py b/sapl/compilacao/migrations/0044_auto_20160307_0918.py deleted file mode 100644 index 302524708..000000000 --- a/sapl/compilacao/migrations/0044_auto_20160307_0918.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:18 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0043_auto_20160110_1733'), - ] - - operations = [ - migrations.AlterField( - model_name='nota', - name='url_externa', - field=models.URLField(blank=True, max_length=1024, verbose_name='Url externa'), - ), - migrations.AlterField( - model_name='publicacao', - name='url_externa', - field=models.URLField(blank=True, max_length=1024, verbose_name='Link para Versão Eletrônica'), - ), - ] diff --git a/sapl/compilacao/migrations/0045_auto_20160311_1117.py b/sapl/compilacao/migrations/0045_auto_20160311_1117.py deleted file mode 100644 index 07645df62..000000000 --- a/sapl/compilacao/migrations/0045_auto_20160311_1117.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-11 14:17 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0044_auto_20160307_0918'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_subsequente', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='compilacao.Dispositivo', verbose_name='Dispositivo Subsequente'), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_substituido', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='compilacao.Dispositivo', verbose_name='Dispositivo Substituido'), - ), - migrations.AlterField( - model_name='dispositivo', - name='inconstitucionalidade', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Declaração de Inconstitucionalidade'), - ), - migrations.AlterField( - model_name='dispositivo', - name='texto', - field=models.TextField(blank=True, default='', verbose_name='Texto na Norma Original'), - ), - ] diff --git a/sapl/compilacao/migrations/0045_auto_20160404_1411.py b/sapl/compilacao/migrations/0045_auto_20160404_1411.py deleted file mode 100644 index a934e8bf0..000000000 --- a/sapl/compilacao/migrations/0045_auto_20160404_1411.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-04 17:11 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0044_auto_20160307_0918'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='observacao', - field=models.TextField(blank=True, default='', verbose_name='Observação'), - preserve_default=False, - ), - ] diff --git a/sapl/compilacao/migrations/0046_auto_20160319_1542.py b/sapl/compilacao/migrations/0046_auto_20160319_1542.py deleted file mode 100644 index c3fc05c14..000000000 --- a/sapl/compilacao/migrations/0046_auto_20160319_1542.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-19 18:42 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0045_auto_20160311_1117'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='inconstitucionalidade', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Declarado Inconstitucional'), - ), - migrations.AlterField( - model_name='dispositivo', - name='texto', - field=models.TextField(blank=True, default='', verbose_name='Texto Original'), - ), - ] diff --git a/sapl/compilacao/migrations/0047_auto_20160330_0027.py b/sapl/compilacao/migrations/0047_auto_20160330_0027.py deleted file mode 100644 index 920c70c2a..000000000 --- a/sapl/compilacao/migrations/0047_auto_20160330_0027.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-30 03:27 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0046_auto_20160319_1542'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_vigencia', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dispositivos_vigencias_set', to='compilacao.Dispositivo', verbose_name='Dispositivo de Vigência'), - ), - ] diff --git a/sapl/compilacao/migrations/0048_auto_20160404_2309.py b/sapl/compilacao/migrations/0048_auto_20160404_2309.py deleted file mode 100644 index 9c25badfc..000000000 --- a/sapl/compilacao/migrations/0048_auto_20160404_2309.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-05 02:09 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0047_auto_20160330_0027'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_vigencia', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivos_vigencias_set', to='compilacao.Dispositivo', verbose_name='Dispositivo de Vigência'), - ), - ] diff --git a/sapl/compilacao/migrations/0049_merge.py b/sapl/compilacao/migrations/0049_merge.py deleted file mode 100644 index beaedb5ff..000000000 --- a/sapl/compilacao/migrations/0049_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-06 17:43 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0045_auto_20160404_1411'), - ('compilacao', '0048_auto_20160404_2309'), - ] - - operations = [ - ] diff --git a/sapl/compilacao/migrations/0050_auto_20160503_0926.py b/sapl/compilacao/migrations/0050_auto_20160503_0926.py deleted file mode 100644 index 27c43be97..000000000 --- a/sapl/compilacao/migrations/0050_auto_20160503_0926.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-03 12:26 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0049_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_subsequente', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_subsequente_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Subsequente'), - ), - migrations.AlterField( - model_name='dispositivo', - name='dispositivo_substituido', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dispositivo_substituido_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Substituido'), - ), - migrations.AlterField( - model_name='nota', - name='dispositivo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_nota_set', to='compilacao.Dispositivo', verbose_name='Dispositivo da Nota'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='relacoes_diretas_pai_filho', - field=models.ManyToManyField(related_name='relacaoes_pai_filho', through='compilacao.TipoDispositivoRelationship', to='compilacao.TipoDispositivo'), - ), - migrations.AlterField( - model_name='vide', - name='dispositivo_base', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_base_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Base'), - ), - migrations.AlterField( - model_name='vide', - name='dispositivo_ref', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivo_citado_set', to='compilacao.Dispositivo', verbose_name='Dispositivo Referido'), - ), - ] diff --git a/sapl/compilacao/migrations/0051_dispositivo_auto_inserido.py b/sapl/compilacao/migrations/0051_dispositivo_auto_inserido.py deleted file mode 100644 index 9b75fabf5..000000000 --- a/sapl/compilacao/migrations/0051_dispositivo_auto_inserido.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-12 16:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0050_auto_20160503_0926'), - ] - - operations = [ - migrations.AddField( - model_name='dispositivo', - name='auto_inserido', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Auto Inserido'), - ), - ] diff --git a/sapl/compilacao/migrations/0052_auto_20160915_1327.py b/sapl/compilacao/migrations/0052_auto_20160915_1327.py deleted file mode 100644 index 5cab6191f..000000000 --- a/sapl/compilacao/migrations/0052_auto_20160915_1327.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-15 16:27 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0051_dispositivo_auto_inserido'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'dispositivo_atualizador', 'ta_publicado', 'publicacao'), ('ta', 'ordem')]), - ), - ] diff --git a/sapl/compilacao/migrations/0053_auto_20160916_1420.py b/sapl/compilacao/migrations/0053_auto_20160916_1420.py deleted file mode 100644 index 15d1446ff..000000000 --- a/sapl/compilacao/migrations/0053_auto_20160916_1420.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 17:20 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0052_auto_20160915_1327'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('ta', 'ordem'), ('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'ta_publicado', 'publicacao')]), - ), - ] diff --git a/sapl/compilacao/migrations/0054_auto_20160916_1424.py b/sapl/compilacao/migrations/0054_auto_20160916_1424.py deleted file mode 100644 index 3c9eb0df6..000000000 --- a/sapl/compilacao/migrations/0054_auto_20160916_1424.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 17:24 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0053_auto_20160916_1420'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('ta', 'ordem'), ('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'dispositivo_atualizador', 'ta_publicado', 'publicacao')]), - ), - ] diff --git a/sapl/compilacao/migrations/0055_dispositivo_dispositivo_de_revogacao.py b/sapl/compilacao/migrations/0055_dispositivo_dispositivo_de_revogacao.py deleted file mode 100644 index daf297852..000000000 --- a/sapl/compilacao/migrations/0055_dispositivo_dispositivo_de_revogacao.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-20 11:57 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0054_auto_20160916_1424'), - ] - - operations = [ - migrations.AddField( - model_name='dispositivo', - name='dispositivo_de_revogacao', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Dispositivo de Revogação'), - ), - ] diff --git a/sapl/compilacao/migrations/0056_auto_20161006_1251.py b/sapl/compilacao/migrations/0056_auto_20161006_1251.py deleted file mode 100644 index d92358d04..000000000 --- a/sapl/compilacao/migrations/0056_auto_20161006_1251.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-06 15:51 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0055_dispositivo_dispositivo_de_revogacao'), - ] - - operations = [ - migrations.AlterField( - model_name='tipotextoarticulado', - name='content_type', - field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Modelo Integrado'), - ), - ] diff --git a/sapl/compilacao/migrations/0057_auto_20161007_2200.py b/sapl/compilacao/migrations/0057_auto_20161007_2200.py deleted file mode 100644 index 9c454d6a0..000000000 --- a/sapl/compilacao/migrations/0057_auto_20161007_2200.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-08 01:00 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0056_auto_20161006_1251'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='texto', - field=models.TextField(blank=True, default='', verbose_name='Texto do Dispositivo'), - ), - migrations.AlterField( - model_name='dispositivo', - name='texto_atualizador', - field=models.TextField(blank=True, default='', verbose_name='Texto do Dispositivo no Dispositivo Atualizador'), - ), - ] diff --git a/sapl/compilacao/migrations/0058_auto_20161008_0143.py b/sapl/compilacao/migrations/0058_auto_20161008_0143.py deleted file mode 100644 index 366984066..000000000 --- a/sapl/compilacao/migrations/0058_auto_20161008_0143.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-08 04:43 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0057_auto_20161007_2200'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='ta', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='dispositivos_set', to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), - ), - migrations.AlterField( - model_name='dispositivo', - name='ta_publicado', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='dispositivos_alterados_pelo_ta_set', to='compilacao.TextoArticulado', verbose_name='Texto Articulado Publicado'), - ), - migrations.AlterField( - model_name='dispositivo', - name='tipo_dispositivo', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='dispositivos_do_tipo_set', to='compilacao.TipoDispositivo', verbose_name='Tipo do Dispositivo'), - ), - ] diff --git a/sapl/compilacao/migrations/0059_auto_20161027_1323.py b/sapl/compilacao/migrations/0059_auto_20161027_1323.py deleted file mode 100644 index fdfe8de37..000000000 --- a/sapl/compilacao/migrations/0059_auto_20161027_1323.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-27 13:23 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0058_auto_20161008_0143'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['ta', 'ordem'], 'permissions': (('change_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico.'), ('change_dispositivo_edicao_avancada', 'Permissão de edição de dispositivos originais via formulários de edição avançada.'), ('change_dispositivo_registros_compilacao', 'Permissão de registro de compilação via editor dinâmico.'), ('change_dispositivo_notificacoes', 'Permissão de acesso às notificações de pendências.')), 'verbose_name': 'Dispositivo', 'verbose_name_plural': 'Dispositivos'}, - ), - ] diff --git a/sapl/compilacao/migrations/0060_auto_20161101_0913.py b/sapl/compilacao/migrations/0060_auto_20161101_0913.py deleted file mode 100644 index 851746ec0..000000000 --- a/sapl/compilacao/migrations/0060_auto_20161101_0913.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-01 09:13 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0059_auto_20161027_1323'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['ta', 'ordem'], 'permissions': (('change_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico.'), ('change_dispositivo_edicao_avancada', 'Permissão de edição de dispositivos originais via formulários de edição avançada.'), ('change_dispositivo_registros_compilacao', 'Permissão de registro de compilação via editor dinâmico.'), ('view_dispositivo_notificacoes', 'Permissão de acesso às notificações de pendências.')), 'verbose_name': 'Dispositivo', 'verbose_name_plural': 'Dispositivos'}, - ), - ] diff --git a/sapl/compilacao/migrations/0061_auto_20161101_1025.py b/sapl/compilacao/migrations/0061_auto_20161101_1025.py deleted file mode 100644 index d74bdc8da..000000000 --- a/sapl/compilacao/migrations/0061_auto_20161101_1025.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-01 10:25 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0060_auto_20161101_0913'), - ] - - operations = [ - migrations.AlterField( - model_name='dispositivo', - name='ta', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dispositivos_set', to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), - ), - ] diff --git a/sapl/compilacao/migrations/0062_auto_20161101_1221.py b/sapl/compilacao/migrations/0062_auto_20161101_1221.py deleted file mode 100644 index 63e703843..000000000 --- a/sapl/compilacao/migrations/0062_auto_20161101_1221.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-01 12:21 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0061_auto_20161101_1025'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['ta', 'ordem'], 'permissions': (('change_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico.'), ('change_dispositivo_edicao_avancada', 'Permissão de edição de dispositivos originais via formulários de edição avançada.'), ('change_dispositivo_registros_compilacao', 'Permissão de registro de compilação via editor dinâmico.'), ('view_dispositivo_notificacoes', 'Permissão de acesso às notificações de pendências.'), ('change_dispositivo_de_vigencia_global', 'Permissão alteração global do dispositivo de vigência')), 'verbose_name': 'Dispositivo', 'verbose_name_plural': 'Dispositivos'}, - ), - ] diff --git a/sapl/compilacao/migrations/0064_auto_20161104_1420.py b/sapl/compilacao/migrations/0064_auto_20161104_1420.py deleted file mode 100644 index 508bc17ac..000000000 --- a/sapl/compilacao/migrations/0064_auto_20161104_1420.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-04 14:20 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('compilacao', '0063_tipotextoarticulado_publicacao_func'), - ] - - operations = [ - migrations.AlterModelOptions( - name='textoarticulado', - options={'ordering': ['-data', '-numero'], 'permissions': (('view_restricted_textoarticulado', 'Pode ver qualquer Texto Articulado'),), 'verbose_name': 'Texto Articulado', 'verbose_name_plural': 'Textos Articulados'}, - ), - migrations.AddField( - model_name='textoarticulado', - name='editable_only_by_owners', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Editável apenas pelos donos do Texto Articulado'), - ), - migrations.AddField( - model_name='textoarticulado', - name='editing_locked', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Texto Articulado em Edição'), - ), - migrations.AddField( - model_name='textoarticulado', - name='owners', - field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Donos do Texto Articulado'), - ), - migrations.AddField( - model_name='textoarticulado', - name='visibilidade', - field=models.IntegerField(choices=[(99, 'Privado'), (79, 'Restrito'), (89, 'Em Edição'), (0, 'Público')], default=99, verbose_name='Visibilidade'), - ), - migrations.AlterField( - model_name='tipotextoarticulado', - name='publicacao_func', - field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Histórico de Publicação'), - ), - ] diff --git a/sapl/compilacao/migrations/0065_auto_20161107_1024.py b/sapl/compilacao/migrations/0065_auto_20161107_1024.py deleted file mode 100644 index 5da908346..000000000 --- a/sapl/compilacao/migrations/0065_auto_20161107_1024.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-07 10:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0064_auto_20161104_1420'), - ] - - operations = [ - migrations.RenameField( - model_name='textoarticulado', - old_name='visibilidade', - new_name='privacidade' - ), - ] diff --git a/sapl/compilacao/migrations/0066_auto_20161107_1028.py b/sapl/compilacao/migrations/0066_auto_20161107_1028.py deleted file mode 100644 index a7c3ca92c..000000000 --- a/sapl/compilacao/migrations/0066_auto_20161107_1028.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-07 10:28 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0065_auto_20161107_1024'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='privacidade', - field=models.IntegerField(choices=[(99, 'Privado'), (79, 'Restrito'), (89, 'Em Edição'), (0, 'Público')], default=99, verbose_name='Privacidade'), - ), - ] diff --git a/sapl/compilacao/migrations/0067_auto_20161107_1351.py b/sapl/compilacao/migrations/0067_auto_20161107_1351.py deleted file mode 100644 index 54fcc16dc..000000000 --- a/sapl/compilacao/migrations/0067_auto_20161107_1351.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-07 13:51 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0066_auto_20161107_1028'), - ] - - operations = [ - migrations.AlterModelOptions( - name='textoarticulado', - options={'ordering': ['-data', '-numero'], 'permissions': (('view_restricted_textoarticulado', 'Pode ver qualquer Texto Articulado'), ('lock_unlock_textoarticulado', 'Pode bloquear/desbloquear edição de Texto Articulado')), 'verbose_name': 'Texto Articulado', 'verbose_name_plural': 'Textos Articulados'}, - ), - ] diff --git a/sapl/compilacao/migrations/0068_auto_20161107_1546.py b/sapl/compilacao/migrations/0068_auto_20161107_1546.py deleted file mode 100644 index 96c5f726b..000000000 --- a/sapl/compilacao/migrations/0068_auto_20161107_1546.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-07 15:46 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0067_auto_20161107_1351'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['ta', 'ordem'], 'permissions': (('change_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico.'), ('change_your_dispositivo_edicao_dinamica', 'Permissão de edição de dispositivos originais via editor dinâmico desde que seja dono.'), ('change_dispositivo_edicao_avancada', 'Permissão de edição de dispositivos originais via formulários de edição avançada.'), ('change_dispositivo_registros_compilacao', 'Permissão de registro de compilação via editor dinâmico.'), ('view_dispositivo_notificacoes', 'Permissão de acesso às notificações de pendências.'), ('change_dispositivo_de_vigencia_global', 'Permissão alteração global do dispositivo de vigência')), 'verbose_name': 'Dispositivo', 'verbose_name_plural': 'Dispositivos'}, - ), - ] diff --git a/sapl/compilacao/migrations/0069_auto_20161107_1932.py b/sapl/compilacao/migrations/0069_auto_20161107_1932.py deleted file mode 100644 index 743167a56..000000000 --- a/sapl/compilacao/migrations/0069_auto_20161107_1932.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-07 19:32 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0068_auto_20161107_1546'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='privacidade', - field=models.IntegerField(choices=[(99, 'Privado'), (79, 'Imotável Restrito'), (69, 'Imutável Público'), (89, 'Em Edição'), (0, 'Público')], default=99, verbose_name='Privacidade'), - ), - ] diff --git a/sapl/compilacao/migrations/0070_perfilestruturaltextoarticulado_parent.py b/sapl/compilacao/migrations/0070_perfilestruturaltextoarticulado_parent.py deleted file mode 100644 index 480d9c15c..000000000 --- a/sapl/compilacao/migrations/0070_perfilestruturaltextoarticulado_parent.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-11 13:01 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0069_auto_20161107_1932'), - ] - - operations = [ - migrations.AddField( - model_name='perfilestruturaltextoarticulado', - name='parent', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='perfil_parent_set', to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfil Herdado'), - ), - ] diff --git a/sapl/compilacao/migrations/0071_tipotextoarticulado_perfis.py b/sapl/compilacao/migrations/0071_tipotextoarticulado_perfis.py deleted file mode 100644 index ee2639bc5..000000000 --- a/sapl/compilacao/migrations/0071_tipotextoarticulado_perfis.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-12 14:25 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0070_perfilestruturaltextoarticulado_parent'), - ] - - operations = [ - migrations.AddField( - model_name='tipotextoarticulado', - name='perfis', - field=models.ManyToManyField(blank=True, help_text='\n Apenas os perfis selecionados aqui estarão disponíveis\n para o editor de Textos Articulados cujo Tipo seja este\n em edição.\n ', to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfis Estruturais de Textos Articulados'), - ), - ] diff --git a/sapl/compilacao/migrations/0072_auto_20161112_1553.py b/sapl/compilacao/migrations/0072_auto_20161112_1553.py deleted file mode 100644 index 421215496..000000000 --- a/sapl/compilacao/migrations/0072_auto_20161112_1553.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-12 15:53 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0071_tipotextoarticulado_perfis'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodispositivo', - name='nota_automatica_prefixo_html', - field=models.TextField(blank=True, verbose_name='Prefixo html da nota automática'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='nota_automatica_sufixo_html', - field=models.TextField(blank=True, verbose_name='Sufixo html da nota automática'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_prefixo_html', - field=models.TextField(blank=True, verbose_name='Prefixo html do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_prefixo_texto', - field=models.TextField(blank=True, verbose_name='Prefixo de Edição do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_sufixo_html', - field=models.TextField(blank=True, verbose_name='Sufixo html do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='rotulo_sufixo_texto', - field=models.TextField(blank=True, verbose_name='Sufixo de Edição do rótulo'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='texto_prefixo_html', - field=models.TextField(blank=True, verbose_name='Prefixo html do texto'), - ), - migrations.AlterField( - model_name='tipodispositivo', - name='texto_sufixo_html', - field=models.TextField(blank=True, verbose_name='Sufixo html do texto'), - ), - ] diff --git a/sapl/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py index f3965c43d..941ec5fe1 100644 --- a/sapl/compilacao/templatetags/compilacao_filters.py +++ b/sapl/compilacao/templatetags/compilacao_filters.py @@ -211,7 +211,7 @@ def heranca(request, d, ignore_ultimo=0, ignore_primeiro=0): ta_id = str(d.ta_id) d_pk = str(d.pk) if ta_id not in ta_dpts_parents or d_pk not in ta_dpts_parents[ta_id]: - #print('recarregando estrutura temporaria de heranças') + # print('recarregando estrutura temporaria de heranças') dpts_parents = {} ta_dpts_parents[ta_id] = dpts_parents update_dispositivos_parents(dpts_parents, ta_id) @@ -296,6 +296,7 @@ def urldetail_content_type(obj): def list(obj): return [obj, ] + @register.filter def can_use_dynamic_editing(texto_articulado, user): return texto_articulado.can_use_dynamic_editing(user) diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py index 2dc8f688c..142b7f46d 100644 --- a/sapl/compilacao/views.py +++ b/sapl/compilacao/views.py @@ -1,7 +1,7 @@ import logging import sys from collections import OrderedDict -from datetime import datetime, timedelta +from datetime import timedelta from braces.views import FormMessagesMixin from django import forms diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 2c9bc7c37..369b6fe9e 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -60,19 +60,22 @@ def get_field_display(obj, fieldname): field = '' try: field = obj._meta.get_field(fieldname) - except: - field = getattr(obj, fieldname) - if 'ManyRelatedManager' not in str(type(field))\ - and 'RelatedManager' not in str(type(field))\ - and 'GenericRelatedObjectManager' not in str(type(field)): - return '', str(field) - - verbose_name = str(field.verbose_name)\ - if hasattr(field, 'verbose_name') else '' - if hasattr(field, 'choices') and field.choices: - value = getattr(obj, 'get_%s_display' % fieldname)() - else: + except Exception as e: + """ nos casos que o fieldname não é um field_model, + ele pode ser um aggregate, annotate, um property, um manager, + ou mesmo uma método no model. + """ value = getattr(obj, fieldname) + verbose_name = '' + + else: + verbose_name = str(field.verbose_name)\ + if hasattr(field, 'verbose_name') else '' + + if hasattr(field, 'choices') and field.choices: + value = getattr(obj, 'get_%s_display' % fieldname)() + else: + value = getattr(obj, fieldname) str_type = str(type(value)) diff --git a/sapl/crud/base.py b/sapl/crud/base.py index b70e7a54a..1a1225cfc 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -840,6 +840,22 @@ class CrudDeleteView(PermissionRequiredContainerCrudMixin, def get_success_url(self): return self.list_url + def delete(self, request, *args, **kwargs): + try: + return super(CrudDeleteView, self).delete(request, args, kwargs) + except models.ProtectedError as err: + error_msg = 'Registro não pode ser removido, pois\ + é referenciado por outros registros:
\ +
    ' + for i in err.protected_objects: + error_msg += '
  • ' + i.__str__() + '
  • ' + error_msg += '
' + + messages.add_message(request, + messages.ERROR, + error_msg) + return self.render_to_response(self.get_context_data()) + class Crud: BaseMixin = CrudBaseMixin diff --git a/sapl/env-backup b/sapl/env-backup new file mode 100644 index 000000000..5824d3eec --- /dev/null +++ b/sapl/env-backup @@ -0,0 +1,8 @@ +SECRET_KEY=qbl0+_+h6^u_k0ggkv&+ff&56s!d(*k+vk^_eu3-to_w&k-kp@ +DATABASE_URL = postgresql://sapl:sapl@localhost:5432/sapl +DEBUG = True +EMAIL_USE_TLS = True +EMAIL_PORT = 587 +EMAIL_HOST = '' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' diff --git a/sapl/legacy/management/commands/migracao_25_31.py b/sapl/legacy/management/commands/migracao_25_31.py index f01b8117a..5334ac7c0 100644 --- a/sapl/legacy/management/commands/migracao_25_31.py +++ b/sapl/legacy/management/commands/migracao_25_31.py @@ -4,7 +4,17 @@ from sapl.legacy import migration class Command(BaseCommand): - help = u'Faz a migração de dados do SAPL 2.5 para o SAPL 3.1' + + help = u'Migração de dados do SAPL 2.5 para o SAPL 3.1' + + def add_arguments(self, parser): + parser.add_argument( + '-f', + action='store_true', + default=False, + dest='force', + help='Não interativa: pula confirmação de exclusão dos dados', + ) def handle(self, *args, **options): - migration.migrate() + migration.migrate(interativo=not options['force']) diff --git a/sapl/legacy/management/commands/migracao_documentos.py b/sapl/legacy/management/commands/migracao_documentos.py new file mode 100644 index 000000000..c096e2905 --- /dev/null +++ b/sapl/legacy/management/commands/migracao_documentos.py @@ -0,0 +1,11 @@ +from django.core.management.base import BaseCommand + +from sapl.legacy.migracao_documentos import migrar_documentos + + +class Command(BaseCommand): + + help = u'Migração documentos do SAPL 2.5 para o SAPL 3.1' + + def handle(self, *args, **options): + migrar_documentos() diff --git a/sapl/legacy/management/commands/recria_constraints.py b/sapl/legacy/management/commands/recria_constraints.py new file mode 100644 index 000000000..9e999e5f6 --- /dev/null +++ b/sapl/legacy/management/commands/recria_constraints.py @@ -0,0 +1,12 @@ +from django.core.management.base import BaseCommand + +from sapl.legacy.migration import recria_constraints + + +class Command(BaseCommand): + + help = (u'Recria constraints do PostgreSQL excluidas durante ' + 'migração de dados') + + def handle(self, *args, **options): + recria_constraints() diff --git a/sapl/legacy/migracao_documentos.py b/sapl/legacy/migracao_documentos.py new file mode 100644 index 000000000..21697dc4f --- /dev/null +++ b/sapl/legacy/migracao_documentos.py @@ -0,0 +1,216 @@ +import mimetypes +import os +import re + +import magic + +from django.db.models.signals import post_delete, post_save +from sapl.base.models import CasaLegislativa +from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa, + Proposicao) +from sapl.norma.models import NormaJuridica +from sapl.parlamentares.models import Parlamentar +from sapl.protocoloadm.models import DocumentoAdministrativo +from sapl.sessao.models import SessaoPlenaria +from sapl.settings import MEDIA_ROOT +from sapl.utils import delete_texto, save_texto + + +# MIGRAÇÃO DE DOCUMENTOS ################################################### +EXTENSOES = { + 'application/msword': '.doc', + 'application/pdf': '.pdf', + 'application/vnd.oasis.opendocument.text': '.odt', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx', # noqa + 'application/xml': '.xml', + 'application/zip': '.zip', + 'image/jpeg': '.jpeg', + 'image/png': '.png', + 'text/html': '.html', + 'text/rtf': '.rtf', + 'text/x-python': '.py', + + # sem extensao + 'application/octet-stream': '', # binário + 'inode/x-empty': '', # vazio +} + +DOCS = { + CasaLegislativa: [( + 'logotipo', + 'props_sapl/logo_casa.gif', + 'casa/logotipo/logo_casa.gif')], + Parlamentar: [( + 'fotografia', + 'parlamentar/fotos/{}_foto_parlamentar', + 'parlamentar/{0}/{0}_foto_parlamentar{1}')], + MateriaLegislativa: [( + 'texto_original', + 'materia/{}_texto_integral', + 'materialegislativa/{0}/{0}_texto_integral{1}')], + DocumentoAcessorio: [( + 'arquivo', + 'materia/{}', + 'documentoacessorio/{0}/{0}{1}')], + NormaJuridica: [( + 'texto_original', + 'norma_juridica/{}_texto_integral', + 'normajuridica/{0}/{0}_texto_integral{1}')], + SessaoPlenaria: [ + ('upload_ata', + 'ata_sessao/{}_ata_sessao', + 'sessaoplenaria/{0}/ata/{0}_ata_sessao{1}'), + ('upload_anexo', + 'anexo_sessao/{}_texto_anexado', + 'sessaoplenaria/{0}/anexo/{0}_texto_anexado{1}') + ], + Proposicao: [( + 'texto_original', + 'proposicao/{}', + 'proposicao/{0}/{0}{1}')], + DocumentoAdministrativo: [( + 'texto_integral', + 'administrativo/{}_texto_integral', + 'documentoadministrativo/{0}/{0}_texto_integral{1}')], +} + +DOCS = {tipo: [(campo, + os.path.join('sapl_documentos', origem), + os.path.join('sapl', destino)) + for campo, origem, destino in campos] + for tipo, campos in DOCS.items()} + + +def em_media(caminho): + return os.path.join(MEDIA_ROOT, caminho) + + +def mover_documento(origem, destino): + origem, destino = [em_media(c) if not os.path.isabs(c) else c + for c in (origem, destino)] + os.makedirs(os.path.dirname(destino), exist_ok=True) + os.rename(origem, destino) + + +def get_casa_legislativa(): + casa = CasaLegislativa.objects.first() + if not casa: + casa = CasaLegislativa.objects.create(**{k: 'PREENCHER...' for k in [ + 'codigo', 'nome', 'sigla', 'endereco', 'cep', 'municipio', 'uf', + ]}) + return casa + + +def migrar_docs_logo(): + print('#### Migrando logotipo da casa ####') + [(_, origem, destino)] = DOCS[CasaLegislativa] + props_sapl = os.path.dirname(origem) + # a pasta props_sapl deve conter apenas o origem e metadatas! + assert set(os.listdir(em_media(props_sapl))) < { + 'logo_casa.gif', '.metadata', 'logo_casa.gif.metadata'} + mover_documento(origem, destino) + casa = get_casa_legislativa() + casa.logotipo = destino + casa.save() + + +def get_extensao(caminho): + mime = magic.from_file(caminho, mime=True) + try: + return EXTENSOES[mime] + except KeyError as e: + raise Exception('\n'.join([ + 'Extensão não conhecida para o arquivo:', + caminho, + 'E mimetype:', + mime, + ' Algumas possibilidades são:', ] + + [" '{}': '{}',".format(mime, ext) + for ext in mimetypes.guess_all_extensions(mime)] + + ['Atualize o código do dicionário EXTENSOES!'] + )) from e + + +def migrar_docs_por_ids(tipo): + for campo, base_origem, base_destino in DOCS[tipo]: + print('#### Migrando {} de {} ####'.format(campo, tipo.__name__)) + + dir_origem, nome_origem = os.path.split(em_media(base_origem)) + pat = re.compile('^{}$'.format(nome_origem.format('(\d+)'))) + + if not os.path.isdir(dir_origem): + print(' >>> O diretório {} não existe! Abortado.'.format( + dir_origem)) + continue + + for arq in os.listdir(dir_origem): + match = pat.match(arq) + if match: + origem = os.path.join(dir_origem, match.group(0)) + id = match.group(1) + extensao = get_extensao(origem) + destino = base_destino.format(id, extensao) + mover_documento(origem, destino) + + # associa documento ao objeto + try: + obj = tipo.objects.get(pk=id) + setattr(obj, campo, destino) + obj.save() + except tipo.DoesNotExist: + msg = ' {} (pk={}) não encontrado para documento em [{}]' + print(msg.format( + tipo.__name__, id, destino)) + + +def desconecta_sinais_indexacao(): + post_save.disconnect(save_texto, NormaJuridica) + post_save.disconnect(save_texto, DocumentoAcessorio) + post_save.disconnect(save_texto, MateriaLegislativa) + post_delete.disconnect(delete_texto, NormaJuridica) + post_delete.disconnect(delete_texto, DocumentoAcessorio) + post_delete.disconnect(delete_texto, MateriaLegislativa) + + +def conecta_sinais_indexacao(): + post_save.connect(save_texto, NormaJuridica) + post_save.connect(save_texto, DocumentoAcessorio) + post_save.connect(save_texto, MateriaLegislativa) + post_delete.connect(delete_texto, NormaJuridica) + post_delete.connect(delete_texto, DocumentoAcessorio) + post_delete.connect(delete_texto, MateriaLegislativa) + + +def migrar_documentos(): + # precisamos excluir os sinais de post_save e post_delete para não que o + # computador não trave com a criação de threads desnecessárias + desconecta_sinais_indexacao() + + # aqui supomos que uma pasta chamada sapl_documentos está em MEDIA_ROOT + # com o conteúdo da pasta de mesmo nome do zope + # Os arquivos da pasta serão movidos para a nova estrutura e a pasta será + # apagada + migrar_docs_logo() + for tipo in [ + Parlamentar, + MateriaLegislativa, + DocumentoAcessorio, + NormaJuridica, + SessaoPlenaria, + Proposicao, + DocumentoAdministrativo, + ]: + migrar_docs_por_ids(tipo) + + sobrando = [os.path.join(dir, file) + for (dir, _, files) in os.walk(em_media('sapl_documentos')) + for file in files] + if sobrando: + print('\n#### Encerrado ####\n\n' + '{} documentos sobraram sem ser migrados!!!'.format( + len(sobrando))) + for doc in sobrando: + print(' {}'. format(doc)) + # + # reconexão dos sinais desligados no inicio da migração de documentos + conecta_sinais_indexacao() diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index f4b6f00a6..baf105e74 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -11,24 +11,26 @@ from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db import OperationalError, ProgrammingError, connections, models -from django.db.models import CharField, Max, ProtectedError, TextField, signals +from django.db.models import CharField, Max, ProtectedError, TextField from django.db.models.base import ModelBase +from django.db.models.signals import post_delete, post_save from model_mommy import mommy from model_mommy.mommy import foreign_key_required, make -from reversion.models import Revision, Version -from sapl.base.models import Autor, ProblemaMigracao +from sapl.base.models import Argumento, Autor, Constraint, ProblemaMigracao from sapl.comissoes.models import Comissao, Composicao, Participacao from sapl.legacy.models import Protocolo as ProtocoloLegado -from sapl.materia.models import (Proposicao, StatusTramitacao, TipoDocumento, +from sapl.materia.models import (DocumentoAcessorio, MateriaLegislativa, + StatusTramitacao, TipoDocumento, TipoMateriaLegislativa, TipoProposicao, Tramitacao) from sapl.norma.models import (AssuntoNorma, NormaJuridica, - TipoVinculoNormaJuridica) + TipoVinculoNormaJuridica, NormaRelacionada) from sapl.parlamentares.models import Parlamentar from sapl.protocoloadm.models import Protocolo, StatusTramitacaoAdministrativo -from sapl.sessao.models import ExpedienteMateria, OrdemDia, SessaoPlenaria -from sapl.utils import normalize +from sapl.sessao.models import ExpedienteMateria, OrdemDia, RegistroVotacao +from sapl.settings import PROJECT_DIR +from sapl.utils import delete_texto, normalize, save_texto # BASE ###################################################################### # apps to be migrated, in app dependency order (very important) @@ -109,6 +111,10 @@ def warn(msg): print('CUIDADO! ' + msg) +def erro(msg): + print('ERRO: ' + msg) + + def get_fk_related(field, value, label=None): if value is None and field.null is False: value = 0 @@ -124,9 +130,7 @@ def get_fk_related(field, value, label=None): if not field.null: fields_dict = get_fields_dict(field.related_model) # Cria stub ao final da tabela para evitar erros - pk = 1 - if hasattr(field.related_model.objects.last(), 'pk'): - pk = field.related_model.objects.last().pk + pk = get_last_value(field.related_model) with reversion.create_revision(): reversion.set_comment('Stub criado pela migração') value = mommy.make( @@ -197,6 +201,12 @@ def iter_sql_records(sql, db): record.__dict__.update(zip(fieldnames, row)) yield record +# Todos os models têm no máximo uma constraint unique together +# Isso é necessário para que o método delete_constraints funcione corretamente +assert all(len(model._meta.unique_together) <= 1 + for app in appconfs + for model in app.models.values()) + def delete_constraints(model): # pega nome da unique constraint dado o nome da tabela @@ -210,51 +220,75 @@ def delete_constraints(model): for r in result: if r[0].endswith('key'): words_list = r[0].split('_') - one_to_one_constraints.append([table, r[0], words_list, model]) + constraint = Constraint.objects.create( + nome_tabela=table, nome_constraint=r[0], + nome_model=model.__name__, tipo_constraint='one_to_one') + for w in words_list: + Argumento.objects.create(constraint=constraint, argumento=w) else: - args = None - args_list = [] if model._meta.unique_together: - args = model._meta.unique_together[0] - args_list = list(args) - unique_constraints.append([table, r[0], args_list, model]) + args_list = model._meta.unique_together[0] + constraint = Constraint.objects.create( + nome_tabela=table, nome_constraint=r[0], + nome_model=model.__name__, + tipo_constraint='unique_together') + for a in args_list: + Argumento.objects.create(constraint=constraint, + argumento=a) warn('Excluindo unique constraint de nome %s' % r[0]) exec_sql("ALTER TABLE %s DROP CONSTRAINT %s;" % (table, r[0])) -def recreate_constraints(): - if one_to_one_constraints: - for constraint in one_to_one_constraints: - table, name, args, model = constraint +def recria_constraints(): + constraints = Constraint.objects.all() + for con in constraints: + if con.tipo_constraint == 'one_to_one': + nome_tabela = con.nome_tabela + nome_constraint = con.nome_constraint + args = [a.argumento for a in con.argumento_set.all()] args_string = '' args_string = "(" + "_".join(map(str, args[2:-1])) + ")" - exec_sql("ALTER TABLE %s ADD CONSTRAINT %s UNIQUE %s;" % - (table, name, args_string)) - if unique_constraints: - for constraint in unique_constraints: - table, name, args, model = constraint + try: + exec_sql("ALTER TABLE %s ADD CONSTRAINT %s UNIQUE %s;" % + (nome_tabela, nome_constraint, args_string)) + except ProgrammingError: + info('A constraint %s já foi recriada!' % nome_constraint) + if con.tipo_constraint == 'unique_together': + nome_tabela = con.nome_tabela + nome_constraint = con.nome_constraint + # Pegando explicitamente o primeiro valor do filter, + # pois pode ser que haja mais de uma ocorrência + model = ContentType.objects.filter( + model=con.nome_model.lower())[0].model_class() + args = [a.argumento for a in con.argumento_set.all()] for i in range(len(args)): if isinstance(model._meta.get_field(args[i]), models.ForeignKey): args[i] = args[i] + '_id' args_string = '' args_string += "(" + ', '.join(map(str, args)) + ")" - exec_sql("ALTER TABLE %s ADD CONSTRAINT %s UNIQUE %s;" % - (table, name, args_string)) - one_to_one_constraints.clear() - unique_constraints.clear() - - -def stub_desnecessario(obj): - lista_fields = [ + try: + exec_sql("ALTER TABLE %s ADD CONSTRAINT %s UNIQUE %s;" % + (nome_tabela, nome_constraint, args_string)) + except ProgrammingError: + info('A constraint %s já foi recriada!' % nome_constraint) + except Exception as err: + problema = re.findall('\(.*?\)', err.args[0]) + erro('A constraint [%s] da tabela [%s] não pode ser recriada' % + (nome_constraint, nome_tabela)) + erro('Os dados %s = %s estão duplicados. ' + 'Arrume antes de recriar as constraints!' % + (problema[0], problema[1])) + + +def obj_desnecessario(obj): + relacoes = [ f for f in obj._meta.get_fields() - if (f.one_to_many or f.one_to_one) and f.auto_created - ] - desnecessario = not any( - rr.related_model.objects.filter(**{rr.field.name: obj}).exists() - for rr in lista_fields) - return desnecessario + if (f.one_to_many or f.one_to_one) and f.auto_created] + sem_referencia = not any(rr.related_model.objects.filter( + **{rr.field.name: obj}).exists() for rr in relacoes) + return sem_referencia def get_last_value(model): @@ -264,7 +298,8 @@ def get_last_value(model): def alter_sequence(model, id): sequence_name = '%s_id_seq' % model._meta.db_table - exec_sql('ALTER SEQUENCE %s RESTART WITH %s;' % (sequence_name, id)) + exec_sql('ALTER SEQUENCE %s RESTART WITH %s MINVALUE -1;' % ( + sequence_name, id)) def save_with_id(new, id): @@ -279,8 +314,7 @@ def save_relation(obj, nome_campo='', problema='', descricao='', eh_stub=False): link = ProblemaMigracao( content_object=obj, nome_campo=nome_campo, problema=problema, - descricao=descricao, eh_stub=eh_stub, - ) + descricao=descricao, eh_stub=eh_stub,) link.save() @@ -303,22 +337,36 @@ def get_fields_dict(model): def fill_vinculo_norma_juridica(): - lista = [('A', 'Altera a norma'), - ('R', 'Revoga integralmente a norma'), - ('P', 'Revoga parcialmente a norma'), - ('T', 'Revoga integralmente por consolidação'), - ('C', 'Norma Correlata'), - ('S', 'Ressalva a Norma'), - ('E', 'Reedita a Norma'), - ('I', 'Reedita a Norma com Alteração'), - ('G', 'Regulamenta a Norma'), - ('K', 'Suspende parcialmente a norma'), - ('L', 'Suspende integralmente a norma'), - ('N', 'Julgada integralmente inconstitucional'), - ('O', 'Julgada parcialmente inconstitucional')] - lista_objs = [VinculoNormaJuridica(sigla=item[0], descricao=item[1]) + lista = [('A', 'Altera o(a)', + 'Alterado(a) pelo(a)'), + ('R', 'Revoga integralmente o(a)', + 'Revogado(a) integralmente pelo(a)'), + ('P', 'Revoga parcialmente o(a)', + 'Revogado(a) parcialmente pelo(a)'), + ('T', 'Revoga integralmente por consolidação', + 'Revogado(a) integralmente por consolidação'), + ('C', 'Norma correlata', + 'Norma correlata'), + ('S', 'Ressalva o(a)', + 'Ressalvada pelo(a)'), + ('E', 'Reedita o(a)', + 'Reeditada pelo(a)'), + ('I', 'Reedita com alteração o(a)', + 'Reeditada com alteração pelo(a)'), + ('G', 'Regulamenta o(a)', + 'Regulamentada pelo(a)'), + ('K', 'Suspende parcialmente o(a)', + 'Suspenso(a) parcialmente pelo(a)'), + ('L', 'Suspende integralmente o(a)', + 'Suspenso(a) integralmente pelo(a)'), + ('N', 'Julga integralmente inconstitucional', + 'Julgada integralmente inconstitucional'), + ('O', 'Julga parcialmente inconstitucional', + 'Julgada parcialmente inconstitucional')] + lista_objs = [TipoVinculoNormaJuridica( + sigla=item[0], descricao_ativa=item[1], descricao_passiva=item[2]) for item in lista] - VinculoNormaJuridica.objects.bulk_create(lista_objs) + TipoVinculoNormaJuridica.objects.bulk_create(lista_objs) class DataMigrator: @@ -363,78 +411,64 @@ class DataMigrator: if field_type == 'CharField' or field_type == 'TextField': if value is None or value == 'None': value = '' - if field.model._meta.label == 'sessao.RegistroVotacao' and \ - field.name == 'ordem' and \ - not isinstance(value, OrdemDia): - try: - new_value = ExpedienteMateria.objects.get(pk=value) - setattr(new, 'expediente', new_value) - setattr(new, field.name, None) - continue - except ObjectDoesNotExist: - msg = 'FK [%s] não encontrada para valor %s ' \ - '(em %s %s)' % ( - field.name, value, - field.model.__name__, label or '---') - with reversion.create_revision(): - value = make_stub(field.related_model, value) - descricao = 'stub criado para entrada orfã!' - warn(msg + ' => ' + descricao) - save_relation(value, [field.name], msg, descricao, - eh_stub=True) - reversion.set_comment('Stub criado pela migração') setattr(new, field.name, value) elif field.model.__name__ == 'TipoAutor' and \ field.name == 'content_type': - try: - value = field.related_model.objects.get( - model=normalize(new.descricao.lower()).replace(' ', - '')) - except ObjectDoesNotExist: - value = None + + model = normalize(new.descricao.lower()).replace(' ', '') + content_types = field.related_model.objects.filter( + model=model).exclude(app_label='legacy') + assert len(content_types) <= 1 + + value = content_types[0] if content_types else None setattr(new, field.name, value) - def migrate(self, obj=appconfs): + def migrate(self, obj=appconfs, interativo=True): # warning: model/app migration order is of utmost importance - exec_sql_file('sapl/legacy/scripts/fix_tables.sql', 'legacy') + exec_sql_file(PROJECT_DIR.child( + 'sapl', 'legacy', 'scripts', 'fix_tables.sql'), 'legacy') self.to_delete = [] # excluindo database antigo. - info('Todos os dados do banco serão excluidos. ' - 'Recomendamos que faça backup do banco sapl antes de continuar.') - info('Deseja continuar? [s/n]') - resposta = input() - if resposta.lower() in ['s', 'sim', 'y', 'yes']: - pass - else: - info('Migração cancelada.') - return 0 + if interativo: + info('Todos os dados do banco serão excluidos. ' + 'Recomendamos que faça backup do banco sapl ' + 'antes de continuar.') + info('Deseja continuar? [s/n]') + resposta = input() + if resposta.lower() in ['s', 'sim', 'y', 'yes']: + pass + else: + info('Migração cancelada.') + return 0 info('Excluindo entradas antigas do banco.') - call(['./manage.py', 'flush', '--settings=sapl.settings', + call([PROJECT_DIR.child('manage.py'), 'flush', '--database=default', '--no-input'], stdout=PIPE) + desconecta_sinais_indexacao() + + fill_vinculo_norma_juridica() info('Começando migração: %s...' % obj) self._do_migrate(obj) - # exclude logically deleted in legacy base + + # Itera várias vezes na lista excluindo o que for possível info('Deletando models com ind_excluido...') - while self.to_delete: - for obj in self.to_delete: - try: - obj.delete() - self.to_delete.remove(obj) - except ProtectedError: - msg = 'A entrada de PK %s da model %s não pode ser ' \ - 'excluida' % (obj.pk, obj._meta.model_name) - descricao = 'Um ou mais objetos protegidos ' - warn(msg + ' => ' + descricao) - save_relation(obj=obj, problema=msg, - descricao=descricao, eh_stub=False) + while self.delete_ind_excluido(): + pass + # Salva o que não pôde ser excluido da lista no problema da migração + for obj in self.to_delete: + msg = 'A entrada de PK %s da model %s não pode ser ' \ + 'excluida' % (obj.pk, obj._meta.model_name) + descricao = 'Um ou mais objetos protegidos' + warn(msg + ' => ' + descricao) + save_relation(obj=obj, problema=msg, + descricao=descricao, eh_stub=False) info('Deletando stubs desnecessários...') while self.delete_stubs(): pass - info('Recriando unique constraints...') - # recreate_constraints() + + conecta_sinais_indexacao() def _do_migrate(self, obj): if isinstance(obj, AppConfig): @@ -463,13 +497,6 @@ class DataMigrator: legacy_model = legacy_app.get_model(legacy_model_name) legacy_pk_name = legacy_model._meta.pk.name - # Clear all model entries - # They may have been created in a previous migration attempt - try: - model.objects.all().delete() - except ProtectedError: - Proposicao.objects.all().delete() - model.objects.all().delete() delete_constraints(model) # setup migration strategy for tables with or without a pk @@ -509,13 +536,31 @@ class DataMigrator: if getattr(old, 'ind_excluido', False): self.to_delete.append(new) + # necessário para ajustar sequence da tabela para o ultimo valor de id + ultimo_valor = get_last_value(model) + alter_sequence(model, ultimo_valor+1) + + def delete_ind_excluido(self): + excluidos = 0 + for obj in self.to_delete: + if obj_desnecessario(obj): + try: + obj.delete() + except ProtectedError: + pass + else: + self.to_delete.remove(obj) + excluidos += 1 + + return excluidos + def delete_stubs(self): excluidos = 0 for obj in ProblemaMigracao.objects.all(): if obj.content_object and obj.eh_stub: original = obj.content_type.get_all_objects_for_this_type( id=obj.object_id) - if stub_desnecessario(original[0]): + if obj_desnecessario(original[0]): qtd_exclusoes, *_ = original.delete() assert qtd_exclusoes == 1 qtd_exclusoes, *_ = obj.delete() @@ -528,9 +573,9 @@ class DataMigrator: return excluidos -def migrate(obj=appconfs): +def migrate(obj=appconfs, interativo=True): dm = DataMigrator() - dm.migrate(obj) + dm.migrate(obj, interativo) # MIGRATION_ADJUSTMENTS ##################################################### @@ -571,11 +616,18 @@ def adjust_participacao(new, old): new.composicao = composicao +def adjust_normarelacionada(new, old): + tipo = TipoVinculoNormaJuridica.objects.filter(sigla=old.tip_vinculo) + assert len(tipo) == 1 + new.tipo_vinculo = tipo[0] + + def adjust_protocolo(new, old): if new.numero is None and not primeira_vez: p = ProtocoloLegado.objects.filter( ano_protocolo=new.ano).aggregate(Max('num_protocolo')) - new.numero = p['num_protocolo__max'] + 1 + numero_maximo = p['num_protocolo__max'] + new.numero = 1 if numero_maximo is None else numero_maximo + 1 primeira_vez.append(True) if new.numero is None and primeira_vez: p = Protocolo.objects.filter( @@ -583,8 +635,29 @@ def adjust_protocolo(new, old): new.numero = p['numero__max'] + 1 -def adjust_sessaoplenaria(new, old): - assert not old.tip_expediente +def adjust_registrovotacao_antes_salvar(new, old): + ordem_dia = OrdemDia.objects.filter( + pk=old.cod_ordem, materia=old.cod_materia) + expediente_materia = ExpedienteMateria.objects.filter( + pk=old.cod_ordem, materia=old.cod_materia) + + if ordem_dia and not expediente_materia: + new.ordem = ordem_dia[0] + if not ordem_dia and expediente_materia: + new.expediente = expediente_materia[0] + + +def adjust_registrovotacao_depois_salvar(new, old): + if not new.ordem and not new.expediente: + with reversion.create_revision(): + problema = 'RegistroVotacao de PK %s não possui nenhuma OrdemDia'\ + ' ou ExpedienteMateria.' % old.pk + descricao = 'RevistroVotacao deve ter no mínimo uma ordem do dia'\ + ' ou expediente vinculado.' + warn(problema + ' => ' + descricao) + save_relation(obj=new, problema=problema, + descricao=descricao, eh_stub=False) + reversion.set_comment('RegistroVotacao sem ordem ou expediente') def adjust_tipoproposicao(new, old): @@ -627,7 +700,9 @@ def adjust_normajuridica_antes_salvar(new, old): def adjust_normajuridica_depois_salvar(new, old): # Ajusta relação M2M lista_pks_assunto = old.cod_assunto.split(',') - for pk_assunto in lista_pks_assunto: + + # list(filter(..)) usado para retirar strings vazias da lista + for pk_assunto in list(filter(None, lista_pks_assunto)): new.assuntos.add(AssuntoNorma.objects.get(pk=pk_assunto)) @@ -677,11 +752,12 @@ AJUSTE_ANTES_SALVAR = { Autor: adjust_autor, Comissao: adjust_comissao, NormaJuridica: adjust_normajuridica_antes_salvar, + NormaRelacionada: adjust_normarelacionada, OrdemDia: adjust_ordemdia, Parlamentar: adjust_parlamentar, Participacao: adjust_participacao, Protocolo: adjust_protocolo, - SessaoPlenaria: adjust_sessaoplenaria, + RegistroVotacao: adjust_registrovotacao_antes_salvar, TipoProposicao: adjust_tipoproposicao, StatusTramitacao: adjust_statustramitacao, StatusTramitacaoAdministrativo: adjust_statustramitacaoadm, @@ -691,6 +767,7 @@ AJUSTE_ANTES_SALVAR = { AJUSTE_DEPOIS_SALVAR = { NormaJuridica: adjust_normajuridica_depois_salvar, Protocolo: adjust_protocolo_depois_salvar, + RegistroVotacao: adjust_registrovotacao_depois_salvar, } # CHECKS #################################################################### @@ -724,3 +801,23 @@ def make_with_log(model, _quantity=None, make_m2m=False, **attrs): return stub make_with_log.required = foreign_key_required + +# DISCONNECT SIGNAL ######################################################## + + +def desconecta_sinais_indexacao(): + post_save.disconnect(save_texto, NormaJuridica) + post_save.disconnect(save_texto, DocumentoAcessorio) + post_save.disconnect(save_texto, MateriaLegislativa) + post_delete.disconnect(delete_texto, NormaJuridica) + post_delete.disconnect(delete_texto, DocumentoAcessorio) + post_delete.disconnect(delete_texto, MateriaLegislativa) + + +def conecta_sinais_indexacao(): + post_save.connect(save_texto, NormaJuridica) + post_save.connect(save_texto, DocumentoAcessorio) + post_save.connect(save_texto, MateriaLegislativa) + post_delete.connect(delete_texto, NormaJuridica) + post_delete.connect(delete_texto, DocumentoAcessorio) + post_delete.connect(delete_texto, MateriaLegislativa) diff --git a/sapl/legacy/migrations/0001_initial.py b/sapl/legacy/migrations/0001_initial.py deleted file mode 100644 index 975b10678..000000000 --- a/sapl/legacy/migrations/0001_initial.py +++ /dev/null @@ -1,1210 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='AcompMateria', - fields=[ - ('cod_cadastro', models.AutoField(serialize=False, primary_key=True)), - ('cod_materia', models.IntegerField()), - ('end_email', models.CharField(max_length=100)), - ('txt_hash', models.CharField(max_length=8)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'acomp_materia', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Anexada', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_materia_principal', models.IntegerField()), - ('cod_materia_anexada', models.IntegerField()), - ('dat_anexacao', models.DateField()), - ('dat_desanexacao', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'anexada', - 'managed': False, - }, - ), - migrations.CreateModel( - name='AssuntoMateria', - fields=[ - ('cod_assunto', models.IntegerField(serialize=False, primary_key=True)), - ('des_assunto', models.CharField(max_length=200)), - ('des_dispositivo', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'assunto_materia', - 'managed': False, - }, - ), - migrations.CreateModel( - name='AssuntoNorma', - fields=[ - ('cod_assunto', models.AutoField(serialize=False, primary_key=True)), - ('des_assunto', models.CharField(max_length=50)), - ('des_estendida', models.CharField(max_length=250, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'assunto_norma', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Autor', - fields=[ - ('cod_autor', models.AutoField(serialize=False, primary_key=True)), - ('cod_partido', models.IntegerField(blank=True, null=True)), - ('cod_comissao', models.IntegerField(blank=True, null=True)), - ('cod_parlamentar', models.IntegerField(blank=True, null=True)), - ('tip_autor', models.IntegerField()), - ('nom_autor', models.CharField(max_length=50, blank=True, null=True)), - ('des_cargo', models.CharField(max_length=50, blank=True, null=True)), - ('col_username', models.CharField(max_length=50, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'autor', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Autoria', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_autor', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('ind_primeiro_autor', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'autoria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='CargoComissao', - fields=[ - ('cod_cargo', models.AutoField(serialize=False, primary_key=True)), - ('des_cargo', models.CharField(max_length=50)), - ('ind_unico', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'cargo_comissao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='CargoMesa', - fields=[ - ('cod_cargo', models.AutoField(serialize=False, primary_key=True)), - ('des_cargo', models.CharField(max_length=50)), - ('ind_unico', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'cargo_mesa', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Coligacao', - fields=[ - ('cod_coligacao', models.AutoField(serialize=False, primary_key=True)), - ('num_legislatura', models.IntegerField()), - ('nom_coligacao', models.CharField(max_length=50)), - ('num_votos_coligacao', models.IntegerField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'coligacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Comissao', - fields=[ - ('cod_comissao', models.AutoField(serialize=False, primary_key=True)), - ('tip_comissao', models.IntegerField()), - ('nom_comissao', models.CharField(max_length=60)), - ('sgl_comissao', models.CharField(max_length=10)), - ('dat_criacao', models.DateField()), - ('dat_extincao', models.DateField(blank=True, null=True)), - ('nom_apelido_temp', models.CharField(max_length=100, blank=True, null=True)), - ('dat_instalacao_temp', models.DateField(blank=True, null=True)), - ('dat_final_prevista_temp', models.DateField(blank=True, null=True)), - ('dat_prorrogada_temp', models.DateField(blank=True, null=True)), - ('dat_fim_comissao', models.DateField(blank=True, null=True)), - ('nom_secretario', models.CharField(max_length=30, blank=True, null=True)), - ('num_tel_reuniao', models.CharField(max_length=15, blank=True, null=True)), - ('end_secretaria', models.CharField(max_length=100, blank=True, null=True)), - ('num_tel_secretaria', models.CharField(max_length=15, blank=True, null=True)), - ('num_fax_secretaria', models.CharField(max_length=15, blank=True, null=True)), - ('des_agenda_reuniao', models.CharField(max_length=100, blank=True, null=True)), - ('loc_reuniao', models.CharField(max_length=100, blank=True, null=True)), - ('txt_finalidade', models.TextField(blank=True, null=True)), - ('end_email', models.CharField(max_length=100, blank=True, null=True)), - ('ind_unid_deliberativa', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'comissao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='ComposicaoColigacao', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_partido', models.IntegerField()), - ('cod_coligacao', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'composicao_coligacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='ComposicaoComissao', - fields=[ - ('cod_comp_comissao', models.AutoField(serialize=False, primary_key=True)), - ('cod_parlamentar', models.IntegerField()), - ('cod_comissao', models.IntegerField()), - ('cod_periodo_comp', models.IntegerField()), - ('cod_cargo', models.IntegerField()), - ('ind_titular', models.IntegerField()), - ('dat_designacao', models.DateField()), - ('dat_desligamento', models.DateField(blank=True, null=True)), - ('des_motivo_desligamento', models.CharField(max_length=150, blank=True, null=True)), - ('obs_composicao', models.CharField(max_length=150, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'composicao_comissao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='ComposicaoMesa', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_parlamentar', models.IntegerField()), - ('cod_sessao_leg', models.IntegerField()), - ('cod_cargo', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'composicao_mesa', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Dependente', - fields=[ - ('cod_dependente', models.AutoField(serialize=False, primary_key=True)), - ('tip_dependente', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('nom_dependente', models.CharField(max_length=50)), - ('sex_dependente', models.CharField(max_length=1)), - ('dat_nascimento', models.DateField(blank=True, null=True)), - ('num_cpf', models.CharField(max_length=14, blank=True, null=True)), - ('num_rg', models.CharField(max_length=15, blank=True, null=True)), - ('num_tit_eleitor', models.CharField(max_length=15, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'dependente', - 'managed': False, - }, - ), - migrations.CreateModel( - name='DespachoInicial', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_materia', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('cod_comissao', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'despacho_inicial', - 'managed': False, - }, - ), - migrations.CreateModel( - name='DocumentoAcessorio', - fields=[ - ('cod_documento', models.AutoField(serialize=False, primary_key=True)), - ('cod_materia', models.IntegerField()), - ('tip_documento', models.IntegerField()), - ('nom_documento', models.CharField(max_length=30)), - ('dat_documento', models.DateField(blank=True, null=True)), - ('nom_autor_documento', models.CharField(max_length=50, blank=True, null=True)), - ('txt_ementa', models.TextField(blank=True, null=True)), - ('txt_indexacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'documento_acessorio', - 'managed': False, - }, - ), - migrations.CreateModel( - name='DocumentoAcessorioAdministrativo', - fields=[ - ('cod_documento_acessorio', models.AutoField(serialize=False, primary_key=True)), - ('cod_documento', models.IntegerField()), - ('tip_documento', models.IntegerField()), - ('nom_documento', models.CharField(max_length=30)), - ('nom_arquivo', models.CharField(max_length=100)), - ('dat_documento', models.DateField(blank=True, null=True)), - ('nom_autor_documento', models.CharField(max_length=50, blank=True, null=True)), - ('txt_assunto', models.TextField(blank=True, null=True)), - ('txt_indexacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'documento_acessorio_administrativo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='DocumentoAdministrativo', - fields=[ - ('cod_documento', models.AutoField(serialize=False, primary_key=True)), - ('tip_documento', models.IntegerField()), - ('num_documento', models.IntegerField()), - ('ano_documento', models.SmallIntegerField()), - ('dat_documento', models.DateField()), - ('num_protocolo', models.IntegerField(blank=True, null=True)), - ('txt_interessado', models.CharField(max_length=50, blank=True, null=True)), - ('cod_autor', models.IntegerField(blank=True, null=True)), - ('num_dias_prazo', models.IntegerField(blank=True, null=True)), - ('dat_fim_prazo', models.DateField(blank=True, null=True)), - ('ind_tramitacao', models.IntegerField()), - ('txt_assunto', models.TextField()), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'documento_administrativo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='ExpedienteMateria', - fields=[ - ('cod_ordem', models.AutoField(serialize=False, primary_key=True)), - ('cod_sessao_plen', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('dat_ordem', models.DateField()), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('txt_resultado', models.TextField(blank=True, null=True)), - ('tip_votacao', models.IntegerField()), - ], - options={ - 'db_table': 'expediente_materia', - 'managed': False, - }, - ), - migrations.CreateModel( - name='ExpedienteSessaoPlenaria', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_sessao_plen', models.IntegerField()), - ('cod_expediente', models.IntegerField()), - ('txt_expediente', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'expediente_sessao_plenaria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Filiacao', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('dat_filiacao', models.DateField()), - ('cod_parlamentar', models.IntegerField()), - ('cod_partido', models.IntegerField()), - ('dat_desfiliacao', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'filiacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='LegislacaoCitada', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_materia', models.IntegerField()), - ('cod_norma', models.IntegerField()), - ('des_disposicoes', models.CharField(max_length=15, blank=True, null=True)), - ('des_parte', models.CharField(max_length=8, blank=True, null=True)), - ('des_livro', models.CharField(max_length=7, blank=True, null=True)), - ('des_titulo', models.CharField(max_length=7, blank=True, null=True)), - ('des_capitulo', models.CharField(max_length=7, blank=True, null=True)), - ('des_secao', models.CharField(max_length=7, blank=True, null=True)), - ('des_subsecao', models.CharField(max_length=7, blank=True, null=True)), - ('des_artigo', models.CharField(max_length=4, blank=True, null=True)), - ('des_paragrafo', models.CharField(max_length=3, blank=True, null=True)), - ('des_inciso', models.CharField(max_length=10, blank=True, null=True)), - ('des_alinea', models.CharField(max_length=3, blank=True, null=True)), - ('des_item', models.CharField(max_length=3, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'legislacao_citada', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Legislatura', - fields=[ - ('num_legislatura', models.IntegerField(serialize=False, primary_key=True)), - ('dat_inicio', models.DateField()), - ('dat_fim', models.DateField()), - ('dat_eleicao', models.DateField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'legislatura', - 'managed': False, - }, - ), - migrations.CreateModel( - name='LexmlRegistroProvedor', - fields=[ - ('cod_provedor', models.AutoField(serialize=False, primary_key=True)), - ('id_provedor', models.IntegerField()), - ('nom_provedor', models.CharField(max_length=255)), - ('sgl_provedor', models.CharField(max_length=15)), - ('adm_email', models.CharField(max_length=50, blank=True, null=True)), - ('nom_responsavel', models.CharField(max_length=255, blank=True, null=True)), - ('tipo', models.CharField(max_length=50)), - ('id_responsavel', models.IntegerField(blank=True, null=True)), - ('xml_provedor', models.TextField(blank=True, null=True)), - ], - options={ - 'db_table': 'lexml_registro_provedor', - 'managed': False, - }, - ), - migrations.CreateModel( - name='LexmlRegistroPublicador', - fields=[ - ('cod_publicador', models.AutoField(serialize=False, primary_key=True)), - ('id_publicador', models.IntegerField()), - ('nom_publicador', models.CharField(max_length=255)), - ('adm_email', models.CharField(max_length=50, blank=True, null=True)), - ('sigla', models.CharField(max_length=255, blank=True, null=True)), - ('nom_responsavel', models.CharField(max_length=255, blank=True, null=True)), - ('tipo', models.CharField(max_length=50)), - ('id_responsavel', models.IntegerField()), - ], - options={ - 'db_table': 'lexml_registro_publicador', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Localidade', - fields=[ - ('cod_localidade', models.IntegerField(serialize=False, primary_key=True)), - ('nom_localidade', models.CharField(max_length=50, blank=True, null=True)), - ('nom_localidade_pesq', models.CharField(max_length=50, blank=True, null=True)), - ('tip_localidade', models.CharField(max_length=1, blank=True, null=True)), - ('sgl_uf', models.CharField(max_length=2, blank=True, null=True)), - ('sgl_regiao', models.CharField(max_length=2, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'localidade', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Mandato', - fields=[ - ('cod_mandato', models.AutoField(serialize=False, primary_key=True)), - ('cod_parlamentar', models.IntegerField()), - ('tip_afastamento', models.IntegerField(blank=True, null=True)), - ('num_legislatura', models.IntegerField()), - ('cod_coligacao', models.IntegerField(blank=True, null=True)), - ('tip_causa_fim_mandato', models.IntegerField(blank=True, null=True)), - ('dat_fim_mandato', models.DateField(blank=True, null=True)), - ('num_votos_recebidos', models.IntegerField(blank=True, null=True)), - ('dat_expedicao_diploma', models.DateField(blank=True, null=True)), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'mandato', - 'managed': False, - }, - ), - migrations.CreateModel( - name='MateriaAssunto', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_assunto', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'materia_assunto', - 'managed': False, - }, - ), - migrations.CreateModel( - name='MateriaLegislativa', - fields=[ - ('cod_materia', models.AutoField(serialize=False, primary_key=True)), - ('tip_id_basica', models.IntegerField()), - ('num_protocolo', models.IntegerField(blank=True, null=True)), - ('num_ident_basica', models.IntegerField()), - ('ano_ident_basica', models.SmallIntegerField()), - ('dat_apresentacao', models.DateField(blank=True, null=True)), - ('tip_apresentacao', models.CharField(max_length=1, blank=True, null=True)), - ('cod_regime_tramitacao', models.IntegerField()), - ('dat_publicacao', models.DateField(blank=True, null=True)), - ('tip_origem_externa', models.IntegerField(blank=True, null=True)), - ('num_origem_externa', models.CharField(max_length=5, blank=True, null=True)), - ('ano_origem_externa', models.SmallIntegerField(blank=True, null=True)), - ('dat_origem_externa', models.DateField(blank=True, null=True)), - ('cod_local_origem_externa', models.IntegerField(blank=True, null=True)), - ('nom_apelido', models.CharField(max_length=50, blank=True, null=True)), - ('num_dias_prazo', models.IntegerField(blank=True, null=True)), - ('dat_fim_prazo', models.DateField(blank=True, null=True)), - ('ind_tramitacao', models.IntegerField()), - ('ind_polemica', models.IntegerField(blank=True, null=True)), - ('des_objeto', models.CharField(max_length=150, blank=True, null=True)), - ('ind_complementar', models.IntegerField(blank=True, null=True)), - ('txt_ementa', models.TextField()), - ('txt_indexacao', models.TextField(blank=True, null=True)), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ('txt_resultado', models.TextField(blank=True, null=True)), - ], - options={ - 'db_table': 'materia_legislativa', - 'managed': False, - }, - ), - migrations.CreateModel( - name='MesaSessaoPlenaria', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_cargo', models.IntegerField()), - ('cod_sessao_leg', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('cod_sessao_plen', models.IntegerField()), - ('ind_excluido', models.IntegerField(blank=True, null=True)), - ], - options={ - 'db_table': 'mesa_sessao_plenaria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='NivelInstrucao', - fields=[ - ('cod_nivel_instrucao', models.AutoField(serialize=False, primary_key=True)), - ('des_nivel_instrucao', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'nivel_instrucao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='NormaJuridica', - fields=[ - ('cod_norma', models.AutoField(serialize=False, primary_key=True)), - ('tip_norma', models.IntegerField()), - ('cod_materia', models.IntegerField(blank=True, null=True)), - ('num_norma', models.IntegerField()), - ('ano_norma', models.SmallIntegerField()), - ('tip_esfera_federacao', models.CharField(max_length=1)), - ('dat_norma', models.DateField(blank=True, null=True)), - ('dat_publicacao', models.DateField(blank=True, null=True)), - ('des_veiculo_publicacao', models.CharField(max_length=30, blank=True, null=True)), - ('num_pag_inicio_publ', models.IntegerField(blank=True, null=True)), - ('num_pag_fim_publ', models.IntegerField(blank=True, null=True)), - ('txt_ementa', models.TextField()), - ('txt_indexacao', models.TextField(blank=True, null=True)), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_complemento', models.IntegerField(blank=True, null=True)), - ('cod_assunto', models.CharField(max_length=16)), - ('dat_vigencia', models.DateField(blank=True, null=True)), - ('timestamp', models.DateTimeField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'norma_juridica', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Numeracao', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_materia', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('tip_materia', models.IntegerField()), - ('num_materia', models.CharField(max_length=5)), - ('ano_materia', models.SmallIntegerField()), - ('dat_materia', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'numeracao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Oradores', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_sessao_plen', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('url_discurso', models.CharField(max_length=150, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'oradores', - 'managed': False, - }, - ), - migrations.CreateModel( - name='OradoresExpediente', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_sessao_plen', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('url_discurso', models.CharField(max_length=150, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'oradores_expediente', - 'managed': False, - }, - ), - migrations.CreateModel( - name='OrdemDia', - fields=[ - ('cod_ordem', models.AutoField(serialize=False, primary_key=True)), - ('cod_sessao_plen', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('dat_ordem', models.DateField()), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ('num_ordem', models.IntegerField()), - ('txt_resultado', models.TextField(blank=True, null=True)), - ('tip_votacao', models.IntegerField()), - ], - options={ - 'db_table': 'ordem_dia', - 'managed': False, - }, - ), - migrations.CreateModel( - name='OrdemDiaPresenca', - fields=[ - ('cod_presenca_ordem_dia', models.AutoField(serialize=False, primary_key=True)), - ('cod_sessao_plen', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('dat_ordem', models.DateField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'ordem_dia_presenca', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Orgao', - fields=[ - ('cod_orgao', models.AutoField(serialize=False, primary_key=True)), - ('nom_orgao', models.CharField(max_length=60)), - ('sgl_orgao', models.CharField(max_length=10)), - ('ind_unid_deliberativa', models.IntegerField()), - ('end_orgao', models.CharField(max_length=100, blank=True, null=True)), - ('num_tel_orgao', models.CharField(max_length=50, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'orgao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Origem', - fields=[ - ('cod_origem', models.AutoField(serialize=False, primary_key=True)), - ('sgl_origem', models.CharField(max_length=10)), - ('nom_origem', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'origem', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Parecer', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_relatoria', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('tip_conclusao', models.CharField(max_length=3, blank=True, null=True)), - ('tip_apresentacao', models.CharField(max_length=1)), - ('txt_parecer', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'parecer', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Parlamentar', - fields=[ - ('cod_parlamentar', models.AutoField(serialize=False, primary_key=True)), - ('cod_nivel_instrucao', models.IntegerField(blank=True, null=True)), - ('tip_situacao_militar', models.IntegerField(blank=True, null=True)), - ('nom_completo', models.CharField(max_length=50)), - ('nom_parlamentar', models.CharField(max_length=50, blank=True, null=True)), - ('sex_parlamentar', models.CharField(max_length=1)), - ('dat_nascimento', models.DateField(blank=True, null=True)), - ('num_cpf', models.CharField(max_length=14, blank=True, null=True)), - ('num_rg', models.CharField(max_length=15, blank=True, null=True)), - ('num_tit_eleitor', models.CharField(max_length=15, blank=True, null=True)), - ('cod_casa', models.IntegerField()), - ('num_gab_parlamentar', models.CharField(max_length=10, blank=True, null=True)), - ('num_tel_parlamentar', models.CharField(max_length=50, blank=True, null=True)), - ('num_fax_parlamentar', models.CharField(max_length=50, blank=True, null=True)), - ('end_residencial', models.CharField(max_length=100, blank=True, null=True)), - ('cod_localidade_resid', models.IntegerField(blank=True, null=True)), - ('num_cep_resid', models.CharField(max_length=9, blank=True, null=True)), - ('num_tel_resid', models.CharField(max_length=50, blank=True, null=True)), - ('num_fax_resid', models.CharField(max_length=50, blank=True, null=True)), - ('end_web', models.CharField(max_length=100, blank=True, null=True)), - ('nom_profissao', models.CharField(max_length=50, blank=True, null=True)), - ('end_email', models.CharField(max_length=100, blank=True, null=True)), - ('des_local_atuacao', models.CharField(max_length=100, blank=True, null=True)), - ('ind_ativo', models.IntegerField()), - ('txt_biografia', models.TextField(blank=True, null=True)), - ('ind_unid_deliberativa', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'parlamentar', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Partido', - fields=[ - ('cod_partido', models.AutoField(serialize=False, primary_key=True)), - ('sgl_partido', models.CharField(max_length=9)), - ('nom_partido', models.CharField(max_length=50)), - ('dat_criacao', models.DateField(blank=True, null=True)), - ('dat_extincao', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'partido', - 'managed': False, - }, - ), - migrations.CreateModel( - name='PeriodoCompComissao', - fields=[ - ('cod_periodo_comp', models.AutoField(serialize=False, primary_key=True)), - ('dat_inicio_periodo', models.DateField()), - ('dat_fim_periodo', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'periodo_comp_comissao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Proposicao', - fields=[ - ('cod_proposicao', models.AutoField(serialize=False, primary_key=True)), - ('cod_materia', models.IntegerField(blank=True, null=True)), - ('cod_autor', models.IntegerField()), - ('tip_proposicao', models.IntegerField()), - ('dat_envio', models.DateTimeField()), - ('dat_recebimento', models.DateTimeField(blank=True, null=True)), - ('txt_descricao', models.CharField(max_length=100)), - ('cod_mat_ou_doc', models.IntegerField(blank=True, null=True)), - ('dat_devolucao', models.DateTimeField(blank=True, null=True)), - ('txt_justif_devolucao', models.CharField(max_length=200, blank=True, null=True)), - ('num_proposicao', models.IntegerField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'proposicao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Protocolo', - fields=[ - ('cod_protocolo', models.AutoField(serialize=False, primary_key=True)), - ('num_protocolo', models.IntegerField(blank=True, null=True)), - ('ano_protocolo', models.SmallIntegerField()), - ('dat_protocolo', models.DateField()), - ('hor_protocolo', models.TimeField()), - ('dat_timestamp', models.DateTimeField()), - ('tip_protocolo', models.IntegerField()), - ('tip_processo', models.IntegerField()), - ('txt_interessado', models.CharField(max_length=60, blank=True, null=True)), - ('cod_autor', models.IntegerField(blank=True, null=True)), - ('txt_assunto_ementa', models.TextField(blank=True, null=True)), - ('tip_documento', models.IntegerField(blank=True, null=True)), - ('tip_materia', models.IntegerField(blank=True, null=True)), - ('num_paginas', models.IntegerField(blank=True, null=True)), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_anulado', models.IntegerField()), - ('txt_user_anulacao', models.CharField(max_length=20, blank=True, null=True)), - ('txt_ip_anulacao', models.CharField(max_length=15, blank=True, null=True)), - ('txt_just_anulacao', models.CharField(max_length=60, blank=True, null=True)), - ('timestamp_anulacao', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'protocolo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='RegimeTramitacao', - fields=[ - ('cod_regime_tramitacao', models.AutoField(serialize=False, primary_key=True)), - ('des_regime_tramitacao', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'regime_tramitacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='RegistroVotacao', - fields=[ - ('cod_votacao', models.AutoField(serialize=False, primary_key=True)), - ('tip_resultado_votacao', models.IntegerField()), - ('cod_materia', models.IntegerField()), - ('cod_ordem', models.IntegerField()), - ('num_votos_sim', models.IntegerField()), - ('num_votos_nao', models.IntegerField()), - ('num_abstencao', models.IntegerField()), - ('txt_observacao', models.TextField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'registro_votacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='RegistroVotacaoParlamentar', - fields=[ - ('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')), - ('cod_votacao', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ('vot_parlamentar', models.CharField(max_length=10)), - ], - options={ - 'db_table': 'registro_votacao_parlamentar', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Relatoria', - fields=[ - ('cod_relatoria', models.AutoField(serialize=False, primary_key=True)), - ('cod_materia', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('tip_fim_relatoria', models.IntegerField(blank=True, null=True)), - ('cod_comissao', models.IntegerField(blank=True, null=True)), - ('dat_desig_relator', models.DateField()), - ('dat_destit_relator', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'relatoria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='SessaoLegislativa', - fields=[ - ('cod_sessao_leg', models.AutoField(serialize=False, primary_key=True)), - ('num_legislatura', models.IntegerField()), - ('num_sessao_leg', models.IntegerField()), - ('tip_sessao_leg', models.CharField(max_length=1)), - ('dat_inicio', models.DateField()), - ('dat_fim', models.DateField()), - ('dat_inicio_intervalo', models.DateField(blank=True, null=True)), - ('dat_fim_intervalo', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'sessao_legislativa', - 'managed': False, - }, - ), - migrations.CreateModel( - name='SessaoPlenaria', - fields=[ - ('cod_sessao_plen', models.AutoField(serialize=False, primary_key=True)), - ('cod_andamento_sessao', models.IntegerField(blank=True, null=True)), - ('tip_sessao', models.IntegerField()), - ('cod_sessao_leg', models.IntegerField()), - ('num_legislatura', models.IntegerField()), - ('tip_expediente', models.CharField(max_length=10)), - ('dat_inicio_sessao', models.DateField()), - ('dia_sessao', models.CharField(max_length=15)), - ('hr_inicio_sessao', models.CharField(max_length=5)), - ('hr_fim_sessao', models.CharField(max_length=5, blank=True, null=True)), - ('num_sessao_plen', models.IntegerField()), - ('dat_fim_sessao', models.DateField(blank=True, null=True)), - ('url_audio', models.CharField(max_length=150, blank=True, null=True)), - ('url_video', models.CharField(max_length=150, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'sessao_plenaria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='SessaoPlenariaPresenca', - fields=[ - ('cod_presenca_sessao', models.AutoField(serialize=False, primary_key=True)), - ('cod_sessao_plen', models.IntegerField()), - ('cod_parlamentar', models.IntegerField()), - ('dat_sessao', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'sessao_plenaria_presenca', - 'managed': False, - }, - ), - migrations.CreateModel( - name='SituacaoMilitar', - fields=[ - ('tip_situacao_militar', models.IntegerField(serialize=False, primary_key=True)), - ('des_tipo_situacao', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_situacao_militar', - 'managed': False, - }, - ), - migrations.CreateModel( - name='StatusTramitacao', - fields=[ - ('cod_status', models.AutoField(serialize=False, primary_key=True)), - ('sgl_status', models.CharField(max_length=10)), - ('des_status', models.CharField(max_length=60)), - ('ind_fim_tramitacao', models.IntegerField()), - ('ind_retorno_tramitacao', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'status_tramitacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='StatusTramitacaoAdministrativo', - fields=[ - ('cod_status', models.AutoField(serialize=False, primary_key=True)), - ('sgl_status', models.CharField(max_length=10)), - ('des_status', models.CharField(max_length=60)), - ('ind_fim_tramitacao', models.IntegerField()), - ('ind_retorno_tramitacao', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'status_tramitacao_administrativo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoAfastamento', - fields=[ - ('tip_afastamento', models.AutoField(serialize=False, primary_key=True)), - ('des_afastamento', models.CharField(max_length=50)), - ('ind_afastamento', models.IntegerField()), - ('ind_fim_mandato', models.IntegerField()), - ('des_dispositivo', models.CharField(max_length=50, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_afastamento', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoAutor', - fields=[ - ('tip_autor', models.IntegerField(serialize=False, primary_key=True)), - ('des_tipo_autor', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_autor', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoComissao', - fields=[ - ('tip_comissao', models.AutoField(serialize=False, primary_key=True)), - ('nom_tipo_comissao', models.CharField(max_length=50)), - ('sgl_natureza_comissao', models.CharField(max_length=1)), - ('sgl_tipo_comissao', models.CharField(max_length=10)), - ('des_dispositivo_regimental', models.CharField(max_length=50, blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_comissao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoDependente', - fields=[ - ('tip_dependente', models.AutoField(serialize=False, primary_key=True)), - ('des_tipo_dependente', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_dependente', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoDocumento', - fields=[ - ('tip_documento', models.AutoField(serialize=False, primary_key=True)), - ('des_tipo_documento', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_documento', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoDocumentoAdministrativo', - fields=[ - ('tip_documento', models.AutoField(serialize=False, primary_key=True)), - ('sgl_tipo_documento', models.CharField(max_length=5)), - ('des_tipo_documento', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_documento_administrativo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoExpediente', - fields=[ - ('cod_expediente', models.AutoField(serialize=False, primary_key=True)), - ('nom_expediente', models.CharField(max_length=100)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_expediente', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoFimRelatoria', - fields=[ - ('tip_fim_relatoria', models.AutoField(serialize=False, primary_key=True)), - ('des_fim_relatoria', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_fim_relatoria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoMateriaLegislativa', - fields=[ - ('tip_materia', models.AutoField(serialize=False, primary_key=True)), - ('sgl_tipo_materia', models.CharField(max_length=5)), - ('des_tipo_materia', models.CharField(max_length=50)), - ('ind_num_automatica', models.IntegerField()), - ('quorum_minimo_votacao', models.IntegerField()), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_materia_legislativa', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoNormaJuridica', - fields=[ - ('tip_norma', models.AutoField(serialize=False, primary_key=True)), - ('voc_lexml', models.CharField(max_length=50, blank=True, null=True)), - ('sgl_tipo_norma', models.CharField(max_length=3)), - ('des_tipo_norma', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_norma_juridica', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoProposicao', - fields=[ - ('tip_proposicao', models.AutoField(serialize=False, primary_key=True)), - ('des_tipo_proposicao', models.CharField(max_length=50)), - ('ind_mat_ou_doc', models.CharField(max_length=1)), - ('tip_mat_ou_doc', models.IntegerField()), - ('nom_modelo', models.CharField(max_length=50)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_proposicao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoResultadoVotacao', - fields=[ - ('tip_resultado_votacao', models.AutoField(serialize=False, primary_key=True)), - ('nom_resultado', models.CharField(max_length=100)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_resultado_votacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TipoSessaoPlenaria', - fields=[ - ('tip_sessao', models.AutoField(serialize=False, primary_key=True)), - ('nom_sessao', models.CharField(max_length=30)), - ('ind_excluido', models.IntegerField()), - ('num_minimo', models.IntegerField()), - ], - options={ - 'db_table': 'tipo_sessao_plenaria', - 'managed': False, - }, - ), - migrations.CreateModel( - name='Tramitacao', - fields=[ - ('cod_tramitacao', models.AutoField(serialize=False, primary_key=True)), - ('cod_status', models.IntegerField(blank=True, null=True)), - ('cod_materia', models.IntegerField()), - ('dat_tramitacao', models.DateField(blank=True, null=True)), - ('cod_unid_tram_local', models.IntegerField(blank=True, null=True)), - ('dat_encaminha', models.DateField(blank=True, null=True)), - ('cod_unid_tram_dest', models.IntegerField(blank=True, null=True)), - ('ind_ult_tramitacao', models.IntegerField()), - ('ind_urgencia', models.IntegerField()), - ('sgl_turno', models.CharField(max_length=1, blank=True, null=True)), - ('txt_tramitacao', models.TextField(blank=True, null=True)), - ('dat_fim_prazo', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tramitacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='TramitacaoAdministrativo', - fields=[ - ('cod_tramitacao', models.AutoField(serialize=False, primary_key=True)), - ('cod_documento', models.IntegerField()), - ('dat_tramitacao', models.DateField(blank=True, null=True)), - ('cod_unid_tram_local', models.IntegerField(blank=True, null=True)), - ('dat_encaminha', models.DateField(blank=True, null=True)), - ('cod_unid_tram_dest', models.IntegerField(blank=True, null=True)), - ('cod_status', models.IntegerField(blank=True, null=True)), - ('ind_ult_tramitacao', models.IntegerField()), - ('txt_tramitacao', models.TextField(blank=True, null=True)), - ('dat_fim_prazo', models.DateField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'tramitacao_administrativo', - 'managed': False, - }, - ), - migrations.CreateModel( - name='UnidadeTramitacao', - fields=[ - ('cod_unid_tramitacao', models.AutoField(serialize=False, primary_key=True)), - ('cod_comissao', models.IntegerField(blank=True, null=True)), - ('cod_orgao', models.IntegerField(blank=True, null=True)), - ('cod_parlamentar', models.IntegerField(blank=True, null=True)), - ('ind_excluido', models.IntegerField()), - ], - options={ - 'db_table': 'unidade_tramitacao', - 'managed': False, - }, - ), - migrations.CreateModel( - name='VinculoNormaJuridica', - fields=[ - ('cod_vinculo', models.AutoField(serialize=False, primary_key=True)), - ('cod_norma_referente', models.IntegerField()), - ('cod_norma_referida', models.IntegerField()), - ('tip_vinculo', models.CharField(max_length=1, blank=True, null=True)), - ('ind_excluido', models.CharField(max_length=1)), - ], - options={ - 'db_table': 'vinculo_norma_juridica', - 'managed': False, - }, - ), - ] diff --git a/sapl/legacy/migrations/__init__.py b/sapl/legacy/migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/sapl/legacy/scripts/fix_tables.sql b/sapl/legacy/scripts/fix_tables.sql index 997379f65..ed93373b1 100644 --- a/sapl/legacy/scripts/fix_tables.sql +++ b/sapl/legacy/scripts/fix_tables.sql @@ -1,3 +1,20 @@ -DROP PROCEDURE IF EXISTS verifica_campos; -CREATE PROCEDURE verifica_campos() BEGIN IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='proposicao' AND column_name='num_proposicao') THEN ALTER TABLE proposicao add column num_proposicao int(11) NULL after txt_justif_devolucao; END IF; END; -CALL verifica_campos; +-- Apaga as restrições somente para essa sessão +SELECT REPLACE(@@sql_mode,'STRICT_TRANS_TABLES,',''); +-- Exclui procedures caso já existam +DROP PROCEDURE IF EXISTS verifica_campos_proposicao; +DROP PROCEDURE IF EXISTS verifica_campos_tipo_materia_legislativa; +DROP PROCEDURE IF EXISTS verifica_campos_sessao_plenaria_presenca; +DROP PROCEDURE IF EXISTS cria_lexml_registro_provedor_e_publicador; +-- Procedure para criar campo num_proposicao em proposicao +CREATE PROCEDURE verifica_campos_proposicao() BEGIN IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='proposicao' AND column_name='num_proposicao') THEN ALTER TABLE proposicao ADD COLUMN num_proposicao INT(11) NULL after txt_justif_devolucao; END IF; END; +-- Procedure para criar campo iind_num_automatica em tipo_materia_legislativa +CREATE PROCEDURE verifica_campos_tipo_materia_legislativa() BEGIN IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='tipo_materia_legislativa' AND column_name='ind_num_automatica') THEN ALTER TABLE tipo_materia_legislativa ADD COLUMN ind_num_automatica BOOLEAN NULL DEFAULT FALSE after des_tipo_materia; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='tipo_materia_legislativa' AND column_name='quorum_minimo_votacao') THEN ALTER TABLE tipo_materia_legislativa ADD COLUMN quorum_minimo_votacao INT(11) NULL after ind_num_automatica; END IF; END; +-- Procedure para criar campos cod_presenca_sessao (sendo a nova PK da tabela) e dat_sessao em sessao_plenaria_presenca +CREATE PROCEDURE verifica_campos_sessao_plenaria_presenca() BEGIN IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='sessao_plenaria_presenca' AND column_name='cod_presenca_sessao') THEN ALTER TABLE sessao_plenaria_presenca DROP PRIMARY KEY, ADD cod_presenca_sessao INT AUTO_INCREMENT PRIMARY KEY FIRST; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='sessao_plenaria_presenca' AND column_name='dat_sessao') THEN ALTER TABLE sessao_plenaria_presenca ADD COLUMN dat_sessao DATE NULL after cod_parlamentar; END IF; END; +-- Procedure para criar tabela lexml_registro_provedor e lexml_registro_publicador +CREATE PROCEDURE cria_lexml_registro_provedor_e_publicador() BEGIN IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='lexml_registro_publicador') THEN CREATE TABLE lexml_registro_publicador (cod_publicador INT AUTO_INCREMENT NOT NULL, id_publicador INT, nom_publicador VARCHAR(255), adm_email VARCHAR(50), sigla VARCHAR(255), nom_responsavel VARCHAR(255), tipo VARCHAR(50), id_responsavel INT, PRIMARY KEY (cod_publicador)); END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='lexml_registro_provedor') THEN CREATE TABLE lexml_registro_provedor (cod_provedor INT AUTO_INCREMENT NOT NULL, id_provedor INT, nom_provedor VARCHAR(255), sgl_provedor VARCHAR(15), adm_email VARCHAR(50), nom_responsavel VARCHAR(255), tipo VARCHAR(50), id_responsavel INT, xml_provedor LONGTEXT, PRIMARY KEY (cod_provedor)); END IF; END; +-- Executa as procedures criadas acima +CALL verifica_campos_proposicao; +CALL verifica_campos_tipo_materia_legislativa; +CALL verifica_campos_sessao_plenaria_presenca; +CALL cria_lexml_registro_provedor_e_publicador; diff --git a/sapl/legacy/scripts/migra_dbs.sh b/sapl/legacy/scripts/migra_dbs.sh new file mode 100755 index 000000000..c7529e015 --- /dev/null +++ b/sapl/legacy/scripts/migra_dbs.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# rodar esse script na raiz do projeto + +parallel --verbose ./sapl/legacy/scripts/migra_um_db.sh :::: <(mysql -u root -padmin -e 'show databases;' | grep '^sapl_') diff --git a/sapl/legacy/scripts/migra_um_db.sh b/sapl/legacy/scripts/migra_um_db.sh new file mode 100755 index 000000000..f55dfb53a --- /dev/null +++ b/sapl/legacy/scripts/migra_um_db.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# rodar esse script na raiz do projeto + +DIR=~/logs_migracao +mkdir -p $DIR + +LOG="$DIR/$1.migracao.log" +rm -f $LOG + +echo "########################################" | tee -a $LOG +echo "MIGRANDO BANCO $1" | tee -a $LOG +echo "########################################" | tee -a $LOG +echo >> $LOG + + +echo "--- DJANGO MIGRATE ---" | tee -a $LOG +echo >> $LOG +DATABASE_NAME=$1 ./manage.py migrate --settings sapl.legacy_migration_settings +echo >> $LOG + +echo "--- MIGRACAO DE DADOS ---" | tee -a $LOG +echo >> $LOG +DATABASE_NAME=$1 ./manage.py migracao_25_31 -f --settings sapl.legacy_migration_settings |& tee -a $LOG +echo >> $LOG + + +echo "--- RECRIANDO CONSTRAINTS ---" | tee -a $LOG +echo >> $LOG +DATABASE_NAME=$1 ./manage.py recria_constraints --settings sapl.legacy_migration_settings |& tee -a $LOG +echo >> $LOG diff --git a/sapl/legacy/scripts/recria_dbs_postgres.sh b/sapl/legacy/scripts/recria_dbs_postgres.sh new file mode 100755 index 000000000..6fbf18794 --- /dev/null +++ b/sapl/legacy/scripts/recria_dbs_postgres.sh @@ -0,0 +1,5 @@ +# (Re)cria todos os bancos postgres para migração +# cria um banco postgres (de mesmo nome) para cada banco mysql cujo nome começa com "sapl_" + +mysql -u root -padmin -e 'show databases;' | grep '^sapl_' | xargs -I{} ./recria_um_db_postgres.sh {} + diff --git a/sapl/legacy/scripts/recria_um_db_postgres.sh b/sapl/legacy/scripts/recria_um_db_postgres.sh new file mode 100755 index 000000000..fd56a95ee --- /dev/null +++ b/sapl/legacy/scripts/recria_um_db_postgres.sh @@ -0,0 +1,5 @@ +# (Re)cria um db postgres +# uso: recria_um_db_postgres + +sudo -u postgres psql -c "drop DATABASE if exists $1" +sudo -u postgres psql -c "CREATE DATABASE $1 WITH OWNER = sapl ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'pt_BR.UTF-8' LC_CTYPE = 'pt_BR.UTF-8' CONNECTION LIMIT = -1 TEMPLATE template0;" diff --git a/sapl/legacy/scripts/shell_para_migracao.sh b/sapl/legacy/scripts/shell_para_migracao.sh new file mode 100755 index 000000000..fb0f3c6de --- /dev/null +++ b/sapl/legacy/scripts/shell_para_migracao.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Inicia um shell_plus com as configurações de migração usando um banco específico +# Uso: ./shell_para_migracao.sh + +# Rode esse script a partir da raiz do projeto + +DATABASE_NAME=$1 ./manage.py shell_plus --settings sapl.legacy_migration_settings diff --git a/sapl/legacy_migration_settings.py b/sapl/legacy_migration_settings.py index d46c4b027..b9d2cefc2 100644 --- a/sapl/legacy_migration_settings.py +++ b/sapl/legacy_migration_settings.py @@ -1,12 +1,11 @@ import os -from decouple import AutoConfig, Config, RepositoryEnv +from decouple import Config, RepositoryEnv from dj_database_url import parse as db_url from .settings import * # flake8: noqa -config = AutoConfig() -config.config = Config(RepositoryEnv(os.path.abspath('sapl/legacy/.env'))) +config = Config(RepositoryEnv(BASE_DIR.child('legacy', '.env'))) INSTALLED_APPS += ( @@ -15,9 +14,16 @@ INSTALLED_APPS += ( DATABASES['legacy'] = config('DATABASE_URL', cast=db_url,) +# Sobrescreve o nome dos bancos caso a variável de ambiente seja definida +# Útil para migração em lote de vários bancos +DATABASE_NAME_OVERRIDE = os.environ.get('DATABASE_NAME') +if DATABASE_NAME_OVERRIDE: + for db in DATABASES.values(): + db['NAME'] = DATABASE_NAME_OVERRIDE + DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ] -DEBUG = False +DEBUG = True MOMMY_CUSTOM_FIELDS_GEN = { 'django.db.models.ForeignKey': 'sapl.legacy.migration.make_with_log' diff --git a/sapl/lexml/migrations/0001_initial.py b/sapl/lexml/migrations/0001_initial.py index 6a2e21391..d79f15080 100644 --- a/sapl/lexml/migrations/0001_initial.py +++ b/sapl/lexml/migrations/0001_initial.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models @@ -6,6 +7,8 @@ from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ ] @@ -13,36 +16,36 @@ class Migration(migrations.Migration): migrations.CreateModel( name='LexmlProvedor', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('id_provedor', models.IntegerField(verbose_name='Id do provedor')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_provedor', models.PositiveIntegerField(verbose_name='Id do provedor')), ('nome', models.CharField(max_length=255, verbose_name='Nome do provedor')), ('sigla', models.CharField(max_length=15)), - ('email_responsavel', models.CharField(blank=True, max_length=50, null=True, verbose_name='E-mail do responsável')), - ('nome_responsavel', models.CharField(blank=True, max_length=255, null=True, verbose_name='Nome do responsável')), + ('email_responsavel', models.EmailField(blank=True, max_length=50, verbose_name='E-mail do responsável')), + ('nome_responsavel', models.CharField(blank=True, max_length=255, verbose_name='Nome do responsável')), ('tipo', models.CharField(max_length=50)), - ('id_responsavel', models.IntegerField(blank=True, null=True, verbose_name='Id do responsável')), - ('xml', models.TextField(blank=True, null=True, verbose_name='XML fornecido pela equipe do LexML:')), + ('id_responsavel', models.PositiveIntegerField(blank=True, null=True, verbose_name='Id do responsável')), + ('xml', models.TextField(blank=True, verbose_name='XML fornecido pela equipe do LexML:')), ], options={ - 'verbose_name_plural': 'Provedores Lexml', 'verbose_name': 'Provedor Lexml', + 'verbose_name_plural': 'Provedores Lexml', }, ), migrations.CreateModel( name='LexmlPublicador', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('id_publicador', models.IntegerField(verbose_name='Id do publicador')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_publicador', models.PositiveIntegerField(verbose_name='Id do publicador')), ('nome', models.CharField(max_length=255, verbose_name='Nome do publicador')), - ('email_responsavel', models.CharField(blank=True, max_length=50, null=True, verbose_name='E-mail do responsável')), - ('sigla', models.CharField(blank=True, max_length=255, null=True, verbose_name='Sigla do Publicador')), - ('nome_responsavel', models.CharField(blank=True, max_length=255, null=True, verbose_name='Nome do responsável')), + ('email_responsavel', models.EmailField(blank=True, max_length=50, verbose_name='E-mail do responsável')), + ('sigla', models.CharField(blank=True, max_length=255, verbose_name='Sigla do Publicador')), + ('nome_responsavel', models.CharField(blank=True, max_length=255, verbose_name='Nome do responsável')), ('tipo', models.CharField(max_length=50)), - ('id_responsavel', models.IntegerField(verbose_name='Id do responsável')), + ('id_responsavel', models.PositiveIntegerField(verbose_name='Id do responsável')), ], options={ - 'verbose_name_plural': 'Publicadores Lexml', 'verbose_name': 'Publicador Lexml', + 'verbose_name_plural': 'Publicadores Lexml', }, ), ] diff --git a/sapl/lexml/migrations/0002_auto_20150806_1614.py b/sapl/lexml/migrations/0002_auto_20150806_1614.py deleted file mode 100644 index b0ae800e0..000000000 --- a/sapl/lexml/migrations/0002_auto_20150806_1614.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('lexml', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='lexmlprovedor', - name='id_provedor', - field=models.PositiveIntegerField(verbose_name='Id do provedor'), - ), - migrations.AlterField( - model_name='lexmlprovedor', - name='id_responsavel', - field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Id do responsável'), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='id_publicador', - field=models.PositiveIntegerField(verbose_name='Id do publicador'), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='id_responsavel', - field=models.PositiveIntegerField(verbose_name='Id do responsável'), - ), - ] diff --git a/sapl/lexml/migrations/0003_auto_20160216_1015.py b/sapl/lexml/migrations/0003_auto_20160216_1015.py deleted file mode 100644 index 245da6911..000000000 --- a/sapl/lexml/migrations/0003_auto_20160216_1015.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('lexml', '0002_auto_20150806_1614'), - ] - - operations = [ - migrations.AlterField( - model_name='lexmlprovedor', - name='email_responsavel', - field=models.CharField(verbose_name='E-mail do responsável', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='lexmlprovedor', - name='nome_responsavel', - field=models.CharField(verbose_name='Nome do responsável', max_length=255, blank=True), - ), - migrations.AlterField( - model_name='lexmlprovedor', - name='xml', - field=models.TextField(verbose_name='XML fornecido pela equipe do LexML:', blank=True), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='email_responsavel', - field=models.CharField(verbose_name='E-mail do responsável', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='nome_responsavel', - field=models.CharField(verbose_name='Nome do responsável', max_length=255, blank=True), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='sigla', - field=models.CharField(verbose_name='Sigla do Publicador', max_length=255, blank=True), - ), - ] diff --git a/sapl/lexml/migrations/0004_auto_20160307_0918.py b/sapl/lexml/migrations/0004_auto_20160307_0918.py deleted file mode 100644 index c6f31833e..000000000 --- a/sapl/lexml/migrations/0004_auto_20160307_0918.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:18 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('lexml', '0003_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='lexmlprovedor', - name='email_responsavel', - field=models.EmailField(blank=True, max_length=50, verbose_name='E-mail do responsável'), - ), - migrations.AlterField( - model_name='lexmlpublicador', - name='email_responsavel', - field=models.EmailField(blank=True, max_length=50, verbose_name='E-mail do responsável'), - ), - ] diff --git a/sapl/materia/apps.py b/sapl/materia/apps.py index 3ac053d1b..ecc8d09de 100644 --- a/sapl/materia/apps.py +++ b/sapl/materia/apps.py @@ -6,3 +6,6 @@ class AppConfig(apps.AppConfig): name = 'sapl.materia' label = 'materia' verbose_name = _('Matéria') + + def ready(self): + from . import signals diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 951a8ed7c..7c0b6d8c8 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -26,16 +26,14 @@ import sapl from sapl.base.models import Autor from sapl.comissoes.models import Comissao from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, - STATUS_TA_PRIVATE, STATUS_TA_PUBLIC, - PerfilEstruturalTextoArticulado, - TextoArticulado) + STATUS_TA_PRIVATE) from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column, to_row) -from sapl.materia.models import (MateriaLegislativa, RegimeTramitacao, +from sapl.materia.models import (AssuntoMateria, MateriaAssunto, + MateriaLegislativa, RegimeTramitacao, TipoDocumento, TipoProposicao) from sapl.norma.models import (LegislacaoCitada, NormaJuridica, TipoNormaJuridica) -from sapl.parlamentares.models import Parlamentar from sapl.protocoloadm.models import Protocolo from sapl.settings import MAX_DOC_UPLOAD_SIZE from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, @@ -496,6 +494,10 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): label=u'Em tramitação', choices=em_tramitacao) + materiaassunto__assunto = django_filters.ModelChoiceFilter( + queryset=AssuntoMateria.objects.all(), + label=_('Assunto da Matéria')) + o = MateriaPesquisaOrderingFilter() class Meta: @@ -512,6 +514,7 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): 'local_origem_externa', 'tramitacao__unidade_tramitacao_destino', 'tramitacao__status', + 'materiaassunto__assunto', 'em_tramitacao', ] @@ -554,6 +557,8 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): [('em_tramitacao', 6), ('o', 6)]) row9 = to_row( + [('materiaassunto__assunto', 12)]) + row10 = to_row( [('ementa', 12)]) self.form.helper = FormHelper() @@ -563,7 +568,7 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet): row1, row2, row3, HTML(autor_label), HTML(autor_modal), - row4, row5, row6, row7, row8, row9, + row4, row5, row6, row7, row8, row9, row10, form_actions(save_label='Pesquisar')) ) @@ -780,7 +785,8 @@ class TipoProposicaoForm(ModelForm): tipo_select = Fieldset(TipoProposicao._meta.verbose_name, Div(to_column(('descricao', 5)), - to_column(('content_type', 7)), css_class='clearfix'), + to_column(('content_type', 7)), + css_class='clearfix'), to_column(('tipo_conteudo_related_radio', 6)), to_column(('perfis', 6))) @@ -847,11 +853,12 @@ class TipoProposicaoSelect(Select): selected_choices.remove(option_value) else: selected_html = '' - return format_html('', - option_value, - selected_html, - str(data_has_perfil), - force_text(option_label)) + return format_html( + '', + option_value, + selected_html, + str(data_has_perfil), + force_text(option_label)) def render_options(self, choices, selected_choices): # Normalize to strings. @@ -1431,3 +1438,12 @@ class ConfirmarProposicaoForm(ProposicaoForm): conteudo_gerado.save() return self.instance + + +class MateriaAssuntoForm(ModelForm): + + class Meta: + model = MateriaAssunto + fields = ['materia', 'assunto'] + + widgets = {'materia': forms.HiddenInput()} diff --git a/sapl/materia/migrations/0001_initial.py b/sapl/materia/migrations/0001_initial.py index 0552b7edb..9993a4e22 100644 --- a/sapl/materia/migrations/0001_initial.py +++ b/sapl/materia/migrations/0001_initial.py @@ -1,451 +1,449 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion +import sapl.utils class Migration(migrations.Migration): + initial = True + dependencies = [ - ('parlamentares', '0001_initial'), + ('base', '0001_initial'), + ('contenttypes', '0002_remove_content_type_name'), ('comissoes', '0001_initial'), + ('compilacao', '0001_initial'), + ('parlamentares', '0001_initial'), ] operations = [ migrations.CreateModel( name='AcompanhamentoMateria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('email', models.CharField(max_length=100, verbose_name='Endereço de E-mail')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('usuario', models.CharField(max_length=50)), + ('email', models.EmailField(max_length=100, verbose_name='E-mail')), + ('data_cadastro', models.DateField(auto_now_add=True)), ('hash', models.CharField(max_length=8)), + ('confirmado', models.BooleanField(default=False)), ], options={ - 'verbose_name_plural': 'Acompanhamentos de Matéria', 'verbose_name': 'Acompanhamento de Matéria', + 'verbose_name_plural': 'Acompanhamentos de Matéria', }, ), migrations.CreateModel( name='Anexada', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_anexacao', models.DateField(verbose_name='Data Anexação')), ('data_desanexacao', models.DateField(blank=True, null=True, verbose_name='Data Desanexação')), ], options={ - 'verbose_name_plural': 'Anexadas', 'verbose_name': 'Anexada', + 'verbose_name_plural': 'Anexadas', }, ), migrations.CreateModel( name='AssuntoMateria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('assunto', models.CharField(max_length=200)), ('dispositivo', models.CharField(max_length=50)), ], options={ - 'verbose_name_plural': 'Assuntos de Matéria', 'verbose_name': 'Assunto de Matéria', - }, - ), - migrations.CreateModel( - name='Autor', - fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('nome', models.CharField(blank=True, max_length=50, null=True, verbose_name='Autor')), - ('cargo', models.CharField(blank=True, max_length=50, null=True)), - ('username', models.CharField(blank=True, max_length=50, null=True)), - ('comissao', models.ForeignKey(blank=True, null=True, to='comissoes.Comissao')), - ('parlamentar', models.ForeignKey(blank=True, null=True, to='parlamentares.Parlamentar')), - ('partido', models.ForeignKey(blank=True, null=True, to='parlamentares.Partido')), - ], - options={ - 'verbose_name_plural': 'Autores', - 'verbose_name': 'Autor', + 'verbose_name_plural': 'Assuntos de Matéria', }, ), migrations.CreateModel( name='Autoria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('primeiro_autor', models.BooleanField(verbose_name='Primeiro Autor')), - ('autor', models.ForeignKey(to='materia.Autor')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('primeiro_autor', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Primeiro Autor')), + ('autor', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='base.Autor', verbose_name='Autor')), ], options={ - 'verbose_name_plural': 'Autorias', 'verbose_name': 'Autoria', + 'verbose_name_plural': 'Autorias', }, ), migrations.CreateModel( name='DespachoInicial', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero_ordem', models.IntegerField()), - ('comissao', models.ForeignKey(to='comissoes.Comissao')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comissao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.Comissao')), ], options={ - 'verbose_name_plural': 'Despachos Iniciais', 'verbose_name': 'Despacho Inicial', + 'verbose_name_plural': 'Despachos Iniciais', }, ), migrations.CreateModel( name='DocumentoAcessorio', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('nome', models.CharField(max_length=30, verbose_name='Descrição')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(max_length=30, verbose_name='Nome')), ('data', models.DateField(blank=True, null=True, verbose_name='Data')), - ('autor', models.CharField(blank=True, max_length=50, null=True, verbose_name='Autor')), - ('ementa', models.TextField(blank=True, null=True, verbose_name='Ementa')), - ('indexacao', models.TextField(blank=True, null=True)), + ('autor', models.CharField(blank=True, max_length=50, verbose_name='Autor')), + ('ementa', models.TextField(blank=True, verbose_name='Ementa')), + ('indexacao', models.TextField(blank=True)), + ('arquivo', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral')), ], options={ - 'verbose_name_plural': 'Documentos Acessórios', 'verbose_name': 'Documento Acessório', + 'verbose_name_plural': 'Documentos Acessórios', }, ), migrations.CreateModel( name='MateriaAssunto', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('assunto', models.ForeignKey(to='materia.AssuntoMateria')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('assunto', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.AssuntoMateria')), ], options={ - 'verbose_name_plural': 'Relações Matéria - Assunto', 'verbose_name': 'Relação Matéria - Assunto', + 'verbose_name_plural': 'Relações Matéria - Assunto', }, ), migrations.CreateModel( name='MateriaLegislativa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero', models.IntegerField(verbose_name='Número')), - ('ano', models.SmallIntegerField(verbose_name='Ano')), - ('numero_protocolo', models.IntegerField(blank=True, null=True, verbose_name='Núm. Protocolo')), - ('data_apresentacao', models.DateField(blank=True, null=True, verbose_name='Data Apresentação')), - ('tipo_apresentacao', models.CharField(blank=True, max_length=1, null=True, verbose_name='Tipo de Apresentação', choices=[('O', 'Oral'), ('E', 'Escrita')])), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero', models.PositiveIntegerField(verbose_name='Número')), + ('ano', models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')), + ('numero_protocolo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Núm. Protocolo')), + ('data_apresentacao', models.DateField(verbose_name='Data Apresentação')), + ('tipo_apresentacao', models.CharField(blank=True, choices=[('O', 'Oral'), ('E', 'Escrita')], max_length=1, verbose_name='Tipo de Apresentação')), ('data_publicacao', models.DateField(blank=True, null=True, verbose_name='Data Publicação')), - ('numero_origem_externa', models.CharField(blank=True, max_length=5, null=True, verbose_name='Número')), - ('ano_origem_externa', models.SmallIntegerField(blank=True, null=True, verbose_name='Ano')), + ('numero_origem_externa', models.CharField(blank=True, max_length=5, verbose_name='Número')), + ('ano_origem_externa', models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano')), ('data_origem_externa', models.DateField(blank=True, null=True, verbose_name='Data')), - ('apelido', models.CharField(blank=True, max_length=50, null=True, verbose_name='Apelido')), - ('dias_prazo', models.IntegerField(blank=True, null=True, verbose_name='Dias Prazo')), + ('apelido', models.CharField(blank=True, max_length=50, verbose_name='Apelido')), + ('dias_prazo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Dias Prazo')), ('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim Prazo')), - ('em_tramitacao', models.BooleanField(verbose_name='Em Tramitação?')), + ('em_tramitacao', models.BooleanField(choices=[(1, 'Sim'), (0, 'Não')], default=False, verbose_name='Em Tramitação?')), ('polemica', models.NullBooleanField(verbose_name='Matéria Polêmica?')), - ('objeto', models.CharField(blank=True, max_length=150, null=True, verbose_name='Objeto')), + ('objeto', models.CharField(blank=True, max_length=150, verbose_name='Objeto')), ('complementar', models.NullBooleanField(verbose_name='É Complementar?')), ('ementa', models.TextField(verbose_name='Ementa')), - ('indexacao', models.TextField(blank=True, null=True, verbose_name='Indexação')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Observação')), - ('resultado', models.TextField(blank=True, null=True)), - ('anexadas', models.ManyToManyField(to='materia.MateriaLegislativa', through='materia.Anexada', related_name='anexo_de')), + ('indexacao', models.TextField(blank=True, verbose_name='Indexação')), + ('observacao', models.TextField(blank=True, verbose_name='Observação')), + ('resultado', models.TextField(blank=True)), + ('texto_original', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original')), + ('anexadas', models.ManyToManyField(blank=True, related_name='anexo_de', through='materia.Anexada', to='materia.MateriaLegislativa')), + ('autores', models.ManyToManyField(through='materia.Autoria', to='base.Autor')), ], options={ - 'verbose_name_plural': 'Matérias Legislativas', 'verbose_name': 'Matéria Legislativa', + 'verbose_name_plural': 'Matérias Legislativas', }, ), migrations.CreateModel( name='Numeracao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero_ordem', models.IntegerField()), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('numero_materia', models.CharField(max_length=5, verbose_name='Número')), - ('ano_materia', models.SmallIntegerField(verbose_name='Ano')), - ('data_materia', models.DateField(blank=True, null=True, verbose_name='Data')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), + ('ano_materia', models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')), + ('data_materia', models.DateField(verbose_name='Data')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), ], options={ - 'verbose_name_plural': 'Numerações', + 'ordering': ('materia', 'tipo_materia', 'numero_materia', 'ano_materia', 'data_materia'), 'verbose_name': 'Numeração', + 'verbose_name_plural': 'Numerações', }, ), migrations.CreateModel( name='Orgao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=60, verbose_name='Nome')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')), - ('unidade_deliberativa', models.BooleanField(verbose_name='Unidade Deliberativa')), - ('endereco', models.CharField(blank=True, max_length=100, null=True, verbose_name='Endereço')), - ('telefone', models.CharField(blank=True, max_length=50, null=True, verbose_name='Telefone')), + ('unidade_deliberativa', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Unidade Deliberativa')), + ('endereco', models.CharField(blank=True, max_length=100, verbose_name='Endereço')), + ('telefone', models.CharField(blank=True, max_length=50, verbose_name='Telefone')), ], options={ - 'verbose_name_plural': 'Órgãos', 'verbose_name': 'Órgão', + 'verbose_name_plural': 'Órgãos', }, ), migrations.CreateModel( name='Origem', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ], options={ - 'verbose_name_plural': 'Origens', 'verbose_name': 'Origem', + 'verbose_name_plural': 'Origens', }, ), migrations.CreateModel( name='Parecer', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('tipo_conclusao', models.CharField(blank=True, max_length=3, null=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('tipo_conclusao', models.CharField(blank=True, max_length=3)), ('tipo_apresentacao', models.CharField(choices=[('O', 'Oral'), ('E', 'Escrita')], max_length=1)), - ('parecer', models.TextField(blank=True, null=True)), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), + ('parecer', models.TextField(blank=True)), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), ], options={ - 'verbose_name_plural': 'Pareceres', 'verbose_name': 'Parecer', + 'verbose_name_plural': 'Pareceres', }, ), migrations.CreateModel( name='Proposicao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('data_envio', models.DateTimeField(null=True, verbose_name='Data de Envio')), - ('data_recebimento', models.DateTimeField(blank=True, null=True, verbose_name='Data de Incorporação')), - ('descricao', models.CharField(max_length=100, verbose_name='Descrição')), - ('data_devolucao', models.DateTimeField(blank=True, null=True, verbose_name='Data de devolução')), - ('justificativa_devolucao', models.CharField(blank=True, max_length=200, null=True, verbose_name='Justificativa da Devolução')), - ('numero_proposicao', models.IntegerField(blank=True, null=True, verbose_name='Número')), - ('autor', models.ForeignKey(to='materia.Autor')), - ('documento', models.ForeignKey(blank=True, null=True, to='materia.DocumentoAcessorio', verbose_name='Documento')), - ('materia', models.ForeignKey(blank=True, null=True, to='materia.MateriaLegislativa', verbose_name='Matéria')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('data_envio', models.DateTimeField(blank=True, null=True, verbose_name='Data de Envio')), + ('data_recebimento', models.DateTimeField(blank=True, null=True, verbose_name='Data de Recebimento')), + ('data_devolucao', models.DateTimeField(blank=True, null=True, verbose_name='Data de Devolução')), + ('descricao', models.TextField(verbose_name='Descrição')), + ('justificativa_devolucao', models.CharField(blank=True, max_length=200, verbose_name='Justificativa da Devolução')), + ('ano', models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano')), + ('numero_proposicao', models.PositiveIntegerField(blank=True, null=True, verbose_name='Número')), + ('status', models.CharField(blank=True, choices=[('E', 'Enviada'), ('R', 'Recebida'), ('I', 'Incorporada')], max_length=1, verbose_name='Status Proposição')), + ('texto_original', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original')), + ('object_id', models.PositiveIntegerField(blank=True, default=None, null=True)), + ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.Autor')), + ('content_type', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Tipo de Material Gerado')), + ('materia_de_vinculo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='proposicao_set', to='materia.MateriaLegislativa', verbose_name='Matéria anexadora')), ], options={ - 'verbose_name_plural': 'Proposições', + 'permissions': (('detail_proposicao_enviada', 'Pode acessar detalhes de uma proposição enviada.'), ('detail_proposicao_devolvida', 'Pode acessar detalhes de uma proposição devolvida.'), ('detail_proposicao_incorporada', 'Pode acessar detalhes de uma proposição incorporada.')), 'verbose_name': 'Proposição', + 'verbose_name_plural': 'Proposições', }, ), migrations.CreateModel( name='RegimeTramitacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('descricao', models.CharField(max_length=50)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), ], options={ - 'verbose_name_plural': 'Regimes Tramitação', 'verbose_name': 'Regime Tramitação', + 'verbose_name_plural': 'Regimes Tramitação', }, ), migrations.CreateModel( name='Relatoria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_designacao_relator', models.DateField(verbose_name='Data Designação')), ('data_destituicao_relator', models.DateField(blank=True, null=True, verbose_name='Data Destituição')), - ('comissao', models.ForeignKey(blank=True, null=True, to='comissoes.Comissao', verbose_name='Localização Atual')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar', verbose_name='Parlamentar')), + ('comissao', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='comissoes.Comissao', verbose_name='Comissão')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar', verbose_name='Parlamentar')), ], options={ - 'verbose_name_plural': 'Relatorias', 'verbose_name': 'Relatoria', + 'verbose_name_plural': 'Relatorias', }, ), migrations.CreateModel( name='StatusTramitacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')), ('descricao', models.CharField(max_length=60, verbose_name='Descrição')), - ('indicador', models.CharField(choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação')), + ('indicador', models.CharField(blank=True, choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação')), ], options={ - 'verbose_name_plural': 'Status de Tramitação', + 'ordering': ['descricao'], 'verbose_name': 'Status de Tramitação', - }, - ), - migrations.CreateModel( - name='TipoAutor', - fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ], - options={ - 'verbose_name_plural': 'Tipos de Autor', - 'verbose_name': 'Tipo de Autor', + 'verbose_name_plural': 'Status de Tramitação', }, ), migrations.CreateModel( name='TipoDocumento', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Tipo Documento')), ], options={ - 'verbose_name_plural': 'Tipos de Documento', 'verbose_name': 'Tipo de Documento', + 'verbose_name_plural': 'Tipos de Documento', }, ), migrations.CreateModel( name='TipoFimRelatoria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Tipo Fim Relatoria')), ], options={ - 'verbose_name_plural': 'Tipos Fim de Relatoria', 'verbose_name': 'Tipo Fim de Relatoria', + 'verbose_name_plural': 'Tipos Fim de Relatoria', }, ), migrations.CreateModel( name='TipoMateriaLegislativa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('sigla', models.CharField(max_length=5, verbose_name='Sigla')), ('descricao', models.CharField(max_length=50, verbose_name='Descrição ')), - ('num_automatica', models.BooleanField()), - ('quorum_minimo_votacao', models.IntegerField()), + ('num_automatica', models.BooleanField(default=False)), + ('quorum_minimo_votacao', models.PositiveIntegerField(blank=True, null=True)), ], options={ - 'verbose_name_plural': 'Tipos de Matérias Legislativas', + 'ordering': ['descricao'], 'verbose_name': 'Tipo de Matéria Legislativa', + 'verbose_name_plural': 'Tipos de Matérias Legislativas', }, ), migrations.CreateModel( name='TipoProposicao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ('materia_ou_documento', models.CharField(choices=[('M', 'Matéria'), ('D', 'Documento')], max_length=1, verbose_name='Gera')), - ('modelo', models.CharField(max_length=50, verbose_name='Modelo XML')), - ('tipo_documento', models.ForeignKey(blank=True, null=True, to='materia.TipoDocumento', verbose_name='Tipo Documento')), - ('tipo_materia', models.ForeignKey(blank=True, null=True, to='materia.TipoMateriaLegislativa', verbose_name='Tipo Matéria')), + ('object_id', models.PositiveIntegerField(blank=True, default=None, null=True)), + ('content_type', models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, to='contenttypes.ContentType', verbose_name='Definição de Tipo')), + ('perfis', models.ManyToManyField(blank=True, help_text='\n Mesmo que em Configurações da Aplicação nas\n Tabelas Auxiliares esteja definido que Proposições possam\n utilizar Textos Articulados, ao gerar uma proposição,\n a solução de Textos Articulados será disponibilizada se\n o Tipo escolhido para a Proposição estiver associado a ao\n menos um Perfil Estrutural de Texto Articulado.\n ', to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfis Estruturais de Textos Articulados')), ], options={ - 'verbose_name_plural': 'Tipos de Proposições', 'verbose_name': 'Tipo de Proposição', + 'verbose_name_plural': 'Tipos de Proposições', }, ), migrations.CreateModel( name='Tramitacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('data_tramitacao', models.DateField(blank=True, null=True, verbose_name='Data Tramitação')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('data_tramitacao', models.DateField(verbose_name='Data Tramitação')), ('data_encaminhamento', models.DateField(blank=True, null=True, verbose_name='Data Encaminhamento')), - ('ultima', models.BooleanField()), - ('urgente', models.BooleanField(verbose_name='Urgente ?')), - ('turno', models.CharField(blank=True, max_length=1, null=True, verbose_name='Turno', choices=[('P', 'Primeiro'), ('S', 'Segundo'), ('Ú', 'Único'), ('L', 'Suplementar'), ('F', 'Final'), ('A', 'Votação única em Regime de Urgência'), ('B', '1ª Votação'), ('C', '2ª e 3ª Votação')])), - ('texto', models.TextField(blank=True, null=True, verbose_name='Texto da Ação')), + ('urgente', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Urgente ?')), + ('turno', models.CharField(blank=True, choices=[('P', 'Primeiro'), ('S', 'Segundo'), ('U', 'Único'), ('L', 'Suplementar'), ('F', 'Final'), ('A', 'Votação única em Regime de Urgência'), ('B', '1ª Votação'), ('C', '2ª e 3ª Votação')], max_length=1, verbose_name='Turno')), + ('texto', models.TextField(verbose_name='Texto da Ação')), ('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim Prazo')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), - ('status', models.ForeignKey(blank=True, null=True, to='materia.StatusTramitacao', verbose_name='Status')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), + ('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.StatusTramitacao', verbose_name='Status')), ], options={ - 'verbose_name_plural': 'Tramitações', 'verbose_name': 'Tramitação', + 'verbose_name_plural': 'Tramitações', }, ), migrations.CreateModel( name='UnidadeTramitacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('comissao', models.ForeignKey(blank=True, null=True, to='comissoes.Comissao', verbose_name='Comissão')), - ('orgao', models.ForeignKey(blank=True, null=True, to='materia.Orgao', verbose_name='Órgão')), - ('parlamentar', models.ForeignKey(blank=True, null=True, to='parlamentares.Parlamentar', verbose_name='Parlamentar')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comissao', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='comissoes.Comissao', verbose_name='Comissão')), + ('orgao', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.Orgao', verbose_name='Órgão')), + ('parlamentar', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar', verbose_name='Parlamentar')), ], options={ - 'verbose_name_plural': 'Unidades de Tramitação', 'verbose_name': 'Unidade de Tramitação', + 'verbose_name_plural': 'Unidades de Tramitação', }, ), migrations.AddField( model_name='tramitacao', name='unidade_tramitacao_destino', - field=models.ForeignKey(blank=True, null=True, to='materia.UnidadeTramitacao', verbose_name='Unidade Destino', related_name='+'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'), ), migrations.AddField( model_name='tramitacao', name='unidade_tramitacao_local', - field=models.ForeignKey(blank=True, null=True, to='materia.UnidadeTramitacao', verbose_name='Unidade Local', related_name='+'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local'), ), migrations.AddField( model_name='relatoria', name='tipo_fim_relatoria', - field=models.ForeignKey(blank=True, null=True, to='materia.TipoFimRelatoria', verbose_name='Motivo Fim Relatoria'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.TipoFimRelatoria', verbose_name='Motivo Fim Relatoria'), ), migrations.AddField( model_name='proposicao', name='tipo', - field=models.ForeignKey(to='materia.TipoProposicao', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.TipoProposicao', verbose_name='Tipo'), ), migrations.AddField( model_name='parecer', name='relatoria', - field=models.ForeignKey(to='materia.Relatoria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.Relatoria'), ), migrations.AddField( model_name='numeracao', name='tipo_materia', - field=models.ForeignKey(to='materia.TipoMateriaLegislativa', verbose_name='Tipo de Matéria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.TipoMateriaLegislativa', verbose_name='Tipo de Matéria'), ), migrations.AddField( model_name='materialegislativa', name='local_origem_externa', - field=models.ForeignKey(blank=True, null=True, to='materia.Origem', verbose_name='Local Origem'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.Origem', verbose_name='Local Origem'), ), migrations.AddField( model_name='materialegislativa', name='regime_tramitacao', - field=models.ForeignKey(to='materia.RegimeTramitacao', verbose_name='Regime Tramitação'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.RegimeTramitacao', verbose_name='Regime Tramitação'), ), migrations.AddField( model_name='materialegislativa', name='tipo', - field=models.ForeignKey(to='materia.TipoMateriaLegislativa', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.TipoMateriaLegislativa', verbose_name='Tipo'), ), migrations.AddField( model_name='materialegislativa', name='tipo_origem_externa', - field=models.ForeignKey(blank=True, null=True, to='materia.TipoMateriaLegislativa', verbose_name='Tipo', related_name='+'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tipo_origem_externa_set', to='materia.TipoMateriaLegislativa', verbose_name='Tipo'), ), migrations.AddField( model_name='materiaassunto', name='materia', - field=models.ForeignKey(to='materia.MateriaLegislativa'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa'), ), migrations.AddField( model_name='documentoacessorio', name='materia', - field=models.ForeignKey(to='materia.MateriaLegislativa'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa'), ), migrations.AddField( model_name='documentoacessorio', name='tipo', - field=models.ForeignKey(to='materia.TipoDocumento', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.TipoDocumento', verbose_name='Tipo'), ), migrations.AddField( model_name='despachoinicial', name='materia', - field=models.ForeignKey(to='materia.MateriaLegislativa'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa'), ), migrations.AddField( model_name='autoria', name='materia', - field=models.ForeignKey(to='materia.MateriaLegislativa'), - ), - migrations.AddField( - model_name='autor', - name='tipo', - field=models.ForeignKey(to='materia.TipoAutor', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa', verbose_name='Matéria Legislativa'), ), migrations.AddField( model_name='anexada', name='materia_anexada', - field=models.ForeignKey(to='materia.MateriaLegislativa', related_name='+'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='materia_anexada_set', to='materia.MateriaLegislativa'), ), migrations.AddField( model_name='anexada', name='materia_principal', - field=models.ForeignKey(to='materia.MateriaLegislativa', related_name='+'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='materia_principal_set', to='materia.MateriaLegislativa'), ), migrations.AddField( model_name='acompanhamentomateria', name='materia', - field=models.ForeignKey(to='materia.MateriaLegislativa'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa'), + ), + migrations.AlterUniqueTogether( + name='tipoproposicao', + unique_together=set([('content_type', 'object_id')]), + ), + migrations.AlterUniqueTogether( + name='proposicao', + unique_together=set([('content_type', 'object_id')]), + ), + migrations.AlterUniqueTogether( + name='materialegislativa', + unique_together=set([('tipo', 'numero', 'ano')]), ), ] diff --git a/sapl/materia/migrations/0002_auto_20150729_1310.py b/sapl/materia/migrations/0002_auto_20150729_1310.py deleted file mode 100644 index a9e9b21c3..000000000 --- a/sapl/materia/migrations/0002_auto_20150729_1310.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='orgao', - name='unidade_deliberativa', - field=models.BooleanField(verbose_name='Unidade Deliberativa', choices=[(True, 'Sim'), (False, 'Não')]), - ), - ] diff --git a/sapl/materia/migrations/0035_auto_20160510_0949.py b/sapl/materia/migrations/0002_auto_20170330_1513.py similarity index 66% rename from sapl/materia/migrations/0035_auto_20160510_0949.py rename to sapl/materia/migrations/0002_auto_20170330_1513.py index eacd9db10..72345fc62 100644 --- a/sapl/materia/migrations/0035_auto_20160510_0949.py +++ b/sapl/materia/migrations/0002_auto_20170330_1513.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 12:49 +# Generated by Django 1.9.12 on 2017-03-30 15:13 from __future__ import unicode_literals from django.db import migrations, models @@ -8,13 +8,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('materia', '0034_auto_20160510_0946'), + ('materia', '0001_initial'), ] operations = [ migrations.AlterField( model_name='documentoacessorio', name='nome', - field=models.CharField(max_length=30, verbose_name='Nome'), + field=models.CharField(max_length=50, verbose_name='Nome'), ), ] diff --git a/sapl/materia/migrations/0003_auto_20150729_1717.py b/sapl/materia/migrations/0003_auto_20150729_1717.py deleted file mode 100644 index 6ffea56bd..000000000 --- a/sapl/materia/migrations/0003_auto_20150729_1717.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0002_auto_20150729_1310'), - ] - - operations = [ - migrations.AlterField( - model_name='despachoinicial', - name='numero_ordem', - field=models.PositiveIntegerField(), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, verbose_name='Ano', null=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='dias_prazo', - field=models.PositiveIntegerField(blank=True, verbose_name='Dias Prazo', null=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='numero', - field=models.PositiveIntegerField(verbose_name='Número'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='numero_protocolo', - field=models.PositiveIntegerField(blank=True, verbose_name='Núm. Protocolo', null=True), - ), - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(verbose_name='Ano'), - ), - migrations.AlterField( - model_name='numeracao', - name='numero_ordem', - field=models.PositiveIntegerField(), - ), - migrations.AlterField( - model_name='proposicao', - name='numero_proposicao', - field=models.PositiveIntegerField(blank=True, verbose_name='Número', null=True), - ), - migrations.AlterField( - model_name='tipomaterialegislativa', - name='quorum_minimo_votacao', - field=models.PositiveIntegerField(), - ), - ] diff --git a/sapl/materia/migrations/0003_auto_20170403_1505.py b/sapl/materia/migrations/0003_auto_20170403_1505.py new file mode 100644 index 000000000..fcd7b8eb0 --- /dev/null +++ b/sapl/materia/migrations/0003_auto_20170403_1505.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2017-04-03 15:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0002_auto_20170330_1513'), + ] + + operations = [ + migrations.AlterField( + model_name='assuntomateria', + name='assunto', + field=models.CharField(max_length=50, verbose_name='Assunto'), + ), + migrations.AlterField( + model_name='assuntomateria', + name='dispositivo', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Descrição do Dispositivo Legal'), + ), + ] diff --git a/sapl/materia/migrations/0004_auto_20170504_1751.py b/sapl/materia/migrations/0004_auto_20170504_1751.py new file mode 100644 index 000000000..49a7e8938 --- /dev/null +++ b/sapl/materia/migrations/0004_auto_20170504_1751.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2017-05-04 17:51 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0003_auto_20170403_1505'), + ] + + operations = [ + migrations.AlterField( + model_name='assuntomateria', + name='dispositivo', + field=models.CharField(blank=True, default='', max_length=200, verbose_name='Descrição do Dispositivo Legal'), + preserve_default=False, + ), + migrations.AlterField( + model_name='materiaassunto', + name='assunto', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.AssuntoMateria', verbose_name='Assunto'), + ), + migrations.AlterField( + model_name='materiaassunto', + name='materia', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa', verbose_name='Matéria'), + ), + ] diff --git a/sapl/materia/migrations/0004_materialegislativa_texto_original.py b/sapl/materia/migrations/0004_materialegislativa_texto_original.py deleted file mode 100644 index 3f5adf474..000000000 --- a/sapl/materia/migrations/0004_materialegislativa_texto_original.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - -import sapl.materia.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0003_auto_20150729_1717'), - ] - - operations = [ - migrations.AddField( - model_name='materialegislativa', - name='texto_original', - field=models.FileField( - null=True, blank=True, verbose_name='Texto original (PDF)', upload_to=sapl.materia.models.texto_upload_path), - ), - ] diff --git a/sapl/materia/migrations/0005_auto_20150923_0941.py b/sapl/materia/migrations/0005_auto_20150923_0941.py deleted file mode 100644 index 24148ca2b..000000000 --- a/sapl/materia/migrations/0005_auto_20150923_0941.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0004_materialegislativa_texto_original'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='materialegislativa', - unique_together=set([('tipo', 'numero', 'ano')]), - ), - ] diff --git a/sapl/materia/migrations/0006_proposicao_status.py b/sapl/materia/migrations/0006_proposicao_status.py deleted file mode 100644 index 9e8678308..000000000 --- a/sapl/materia/migrations/0006_proposicao_status.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0005_auto_20150923_0941'), - ] - - operations = [ - migrations.AddField( - model_name='proposicao', - name='status', - field=models.CharField(verbose_name='Status Proposição', max_length=1, blank=True, choices=[('P', 'Pendente'), ('D', 'Devolvida'), ('I', 'Incorporada')], null=True), - ), - ] diff --git a/sapl/materia/migrations/0007_auto_20151021_1200.py b/sapl/materia/migrations/0007_auto_20151021_1200.py deleted file mode 100644 index 2cdad3b5c..000000000 --- a/sapl/materia/migrations/0007_auto_20151021_1200.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0006_proposicao_status'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='status', - field=models.CharField(max_length=1, verbose_name='Status Proposição', blank=True, null=True, choices=[('E', 'Enviada'), ('D', 'Devolvida'), ('I', 'Incorporada')]), - ), - ] diff --git a/sapl/materia/migrations/0008_auto_20151029_1416.py b/sapl/materia/migrations/0008_auto_20151029_1416.py deleted file mode 100644 index 4ee72acaf..000000000 --- a/sapl/materia/migrations/0008_auto_20151029_1416.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0007_auto_20151021_1200'), - ] - - operations = [ - migrations.RemoveField( - model_name='despachoinicial', - name='numero_ordem', - ) - ] diff --git a/sapl/materia/migrations/0009_auto_20151029_1420.py b/sapl/materia/migrations/0009_auto_20151029_1420.py deleted file mode 100644 index b831a3885..000000000 --- a/sapl/materia/migrations/0009_auto_20151029_1420.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0008_auto_20151029_1416'), - ] - - operations = [ - migrations.RemoveField( - model_name='numeracao', - name='numero_ordem', - ) - ] diff --git a/sapl/materia/migrations/0010_auto_20151117_1551.py b/sapl/materia/migrations/0010_auto_20151117_1551.py deleted file mode 100644 index e9f095b1c..000000000 --- a/sapl/materia/migrations/0010_auto_20151117_1551.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - -import sapl.materia.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0009_auto_20151029_1420'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='texto_original', - field=models.FileField(verbose_name='Texto Original (PDF)', - upload_to=sapl.materia.models.texto_upload_path, blank=True, null=True), - ), - ] diff --git a/sapl/materia/migrations/0011_proposicao_texto_original.py b/sapl/materia/migrations/0011_proposicao_texto_original.py deleted file mode 100644 index 49f74fb6c..000000000 --- a/sapl/materia/migrations/0011_proposicao_texto_original.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import sapl.materia.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0010_auto_20151117_1551'), - ] - - operations = [ - migrations.AddField( - model_name='proposicao', - name='texto_original', - field=models.FileField(upload_to=sapl.materia.models.texto_upload_path, - verbose_name='Texto Original (PDF)', blank=True, null=True), - ), - ] diff --git a/sapl/materia/migrations/0012_auto_20151124_1328.py b/sapl/materia/migrations/0012_auto_20151124_1328.py deleted file mode 100644 index c886d6329..000000000 --- a/sapl/materia/migrations/0012_auto_20151124_1328.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0011_proposicao_texto_original'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='autor', - field=models.ForeignKey(null=True, to='materia.Autor', blank=True), - ), - ] diff --git a/sapl/materia/migrations/0013_remove_tramitacao_ultima.py b/sapl/materia/migrations/0013_remove_tramitacao_ultima.py deleted file mode 100644 index b887dd3ae..000000000 --- a/sapl/materia/migrations/0013_remove_tramitacao_ultima.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0012_auto_20151124_1328'), - ] - - operations = [ - migrations.RemoveField( - model_name='tramitacao', - name='ultima', - ), - ] diff --git a/sapl/materia/migrations/0014_autoria_partido.py b/sapl/materia/migrations/0014_autoria_partido.py deleted file mode 100644 index fcdb5df70..000000000 --- a/sapl/materia/migrations/0014_autoria_partido.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0010_auto_20160107_1850'), - ('materia', '0013_remove_tramitacao_ultima'), - ] - - operations = [ - migrations.AddField( - model_name='autoria', - name='partido', - field=models.ForeignKey(null=True, to='parlamentares.Partido', blank=True), - ), - ] diff --git a/sapl/materia/migrations/0015_auto_20160216_1015.py b/sapl/materia/migrations/0015_auto_20160216_1015.py deleted file mode 100644 index 9e3ecd8f1..000000000 --- a/sapl/materia/migrations/0015_auto_20160216_1015.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0014_autoria_partido'), - ] - - operations = [ - migrations.AlterField( - model_name='autor', - name='cargo', - field=models.CharField(max_length=50, blank=True), - ), - migrations.AlterField( - model_name='autor', - name='nome', - field=models.CharField(verbose_name='Autor', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='autor', - name='username', - field=models.CharField(max_length=50, blank=True), - ), - migrations.AlterField( - model_name='documentoacessorio', - name='autor', - field=models.CharField(verbose_name='Autor', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='documentoacessorio', - name='ementa', - field=models.TextField(verbose_name='Ementa', blank=True), - ), - migrations.AlterField( - model_name='documentoacessorio', - name='indexacao', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='apelido', - field=models.CharField(verbose_name='Apelido', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='indexacao', - field=models.TextField(verbose_name='Indexação', blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='numero_origem_externa', - field=models.CharField(verbose_name='Número', max_length=5, blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='objeto', - field=models.CharField(verbose_name='Objeto', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='observacao', - field=models.TextField(verbose_name='Observação', blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='resultado', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='materialegislativa', - name='tipo_apresentacao', - field=models.CharField(blank=True, verbose_name='Tipo de Apresentação', choices=[('O', 'Oral'), ('E', 'Escrita')], max_length=1), - ), - migrations.AlterField( - model_name='numeracao', - name='data_materia', - field=models.DateField(verbose_name='Data', blank=True), - ), - migrations.AlterField( - model_name='orgao', - name='endereco', - field=models.CharField(verbose_name='Endereço', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='orgao', - name='telefone', - field=models.CharField(verbose_name='Telefone', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parecer', - name='parecer', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='parecer', - name='tipo_conclusao', - field=models.CharField(max_length=3, blank=True), - ), - migrations.AlterField( - model_name='proposicao', - name='justificativa_devolucao', - field=models.CharField(verbose_name='Justificativa da Devolução', max_length=200, blank=True), - ), - migrations.AlterField( - model_name='proposicao', - name='status', - field=models.CharField(blank=True, verbose_name='Status Proposição', choices=[('E', 'Enviada'), ('D', 'Devolvida'), ('I', 'Incorporada')], max_length=1), - ), - migrations.AlterField( - model_name='tramitacao', - name='texto', - field=models.TextField(verbose_name='Texto da Ação', blank=True), - ), - migrations.AlterField( - model_name='tramitacao', - name='turno', - field=models.CharField(blank=True, verbose_name='Turno', choices=[('P', 'Primeiro'), ('S', 'Segundo'), ('Ú', 'Único'), ('L', 'Suplementar'), ('F', 'Final'), ('A', 'Votação única em Regime de Urgência'), ('B', '1ª Votação'), ('C', '2ª e 3ª Votação')], max_length=1), - ), - ] diff --git a/sapl/materia/migrations/0016_auto_20160223_0813.py b/sapl/materia/migrations/0016_auto_20160223_0813.py deleted file mode 100644 index 0d2cb84a5..000000000 --- a/sapl/materia/migrations/0016_auto_20160223_0813.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import datetime -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0015_auto_20160216_1015'), - ] - - operations = [ - migrations.AddField( - model_name='acompanhamentomateria', - name='data_cadastro', - field=models.DateField(auto_now_add=True, default=datetime.datetime(2016, 2, 23, 11, 13, 25, 362112, tzinfo=utc)), - preserve_default=False, - ), - migrations.AddField( - model_name='acompanhamentomateria', - name='usuario', - field=models.CharField(max_length=50, default=''), - preserve_default=False, - ), - ] diff --git a/sapl/materia/migrations/0016_auto_20160225_0918.py b/sapl/materia/migrations/0016_auto_20160225_0918.py deleted file mode 100644 index b404a7e6c..000000000 --- a/sapl/materia/migrations/0016_auto_20160225_0918.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0015_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='tramitacao', - name='turno', - field=models.CharField(max_length=1, verbose_name='Turno', choices=[('P', 'Primeiro'), ('S', 'Segundo'), ('U', 'Único'), ('L', 'Suplementar'), ('F', 'Final'), ('A', 'Votação única em Regime de Urgência'), ('B', '1ª Votação'), ('C', '2ª e 3ª Votação')], blank=True), - ), - ] diff --git a/sapl/materia/migrations/0017_acompanhamentomateria_confirmado.py b/sapl/materia/migrations/0017_acompanhamentomateria_confirmado.py deleted file mode 100644 index 59bd9dac2..000000000 --- a/sapl/materia/migrations/0017_acompanhamentomateria_confirmado.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0016_auto_20160223_0813'), - ] - - operations = [ - migrations.AddField( - model_name='acompanhamentomateria', - name='confirmado', - field=models.BooleanField(default=False), - ), - ] diff --git a/sapl/materia/migrations/0018_merge.py b/sapl/materia/migrations/0018_merge.py deleted file mode 100644 index 082356b16..000000000 --- a/sapl/materia/migrations/0018_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-02-26 14:25 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0017_acompanhamentomateria_confirmado'), - ('materia', '0016_auto_20160225_0918'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0019_auto_20160229_1321.py b/sapl/materia/migrations/0019_auto_20160229_1321.py deleted file mode 100644 index 02f0f3e81..000000000 --- a/sapl/materia/migrations/0019_auto_20160229_1321.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0018_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='anexadas', - field=models.ManyToManyField(to='materia.MateriaLegislativa', blank=True, related_name='anexo_de', through='materia.Anexada'), - ), - ] diff --git a/sapl/materia/migrations/0020_auto_20160229_1324.py b/sapl/materia/migrations/0020_auto_20160229_1324.py deleted file mode 100644 index cbe51e7c4..000000000 --- a/sapl/materia/migrations/0020_auto_20160229_1324.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -from django.utils.timezone import utc -import datetime - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0019_auto_20160229_1321'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='data_apresentacao', - field=models.DateField(default=datetime.datetime(2016, 2, 29, 16, 24, 24, 963568, tzinfo=utc), verbose_name='Data Apresentação'), - preserve_default=False, - ), - ] diff --git a/sapl/materia/migrations/0021_auto_20160307_0905.py b/sapl/materia/migrations/0021_auto_20160307_0905.py deleted file mode 100644 index b7e65bc30..000000000 --- a/sapl/materia/migrations/0021_auto_20160307_0905.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0020_auto_20160229_1324'), - ] - - operations = [ - migrations.AlterField( - model_name='acompanhamentomateria', - name='email', - field=models.EmailField(max_length=100, verbose_name='E-mail'), - ), - ] diff --git a/sapl/materia/migrations/0022_auto_20160309_1323.py b/sapl/materia/migrations/0022_auto_20160309_1323.py deleted file mode 100644 index 23c874dc1..000000000 --- a/sapl/materia/migrations/0022_auto_20160309_1323.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-09 16:23 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0021_auto_20160307_0905'), - ] - - operations = [ - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='proposicao', - name='descricao', - field=models.TextField(max_length=100, verbose_name='Descrição'), - ), - ] diff --git a/sapl/materia/migrations/0023_auto_20160309_1407.py b/sapl/materia/migrations/0023_auto_20160309_1407.py deleted file mode 100644 index ea07440b4..000000000 --- a/sapl/materia/migrations/0023_auto_20160309_1407.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-09 17:07 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0022_auto_20160309_1323'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0024_auto_20160311_1501.py b/sapl/materia/migrations/0024_auto_20160311_1501.py deleted file mode 100644 index dd2ca6397..000000000 --- a/sapl/materia/migrations/0024_auto_20160311_1501.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-11 18:01 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0023_auto_20160309_1407'), - ] - - operations = [ - migrations.AlterField( - model_name='numeracao', - name='data_materia', - field=models.DateField(verbose_name='Data'), - ), - ] diff --git a/sapl/materia/migrations/0025_auto_20160311_1613.py b/sapl/materia/migrations/0025_auto_20160311_1613.py deleted file mode 100644 index 3223ea78c..000000000 --- a/sapl/materia/migrations/0025_auto_20160311_1613.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-11 19:13 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0024_auto_20160311_1501'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='data_envio', - field=models.DateTimeField(blank=True, null=True, verbose_name='Data de Envio'), - ), - ] diff --git a/sapl/materia/migrations/0026_auto_20160322_1514.py b/sapl/materia/migrations/0026_auto_20160322_1514.py deleted file mode 100644 index 91af09313..000000000 --- a/sapl/materia/migrations/0026_auto_20160322_1514.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-22 18:14 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0025_auto_20160311_1613'), - ] - - operations = [ - migrations.AlterField( - model_name='tramitacao', - name='data_tramitacao', - field=models.DateField(verbose_name='Data Tramitação'), - ), - migrations.AlterField( - model_name='tramitacao', - name='status', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.StatusTramitacao', verbose_name='Status'), - ), - migrations.AlterField( - model_name='tramitacao', - name='texto', - field=models.TextField(verbose_name='Texto da Ação'), - ), - migrations.AlterField( - model_name='tramitacao', - name='unidade_tramitacao_destino', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'), - ), - migrations.AlterField( - model_name='tramitacao', - name='unidade_tramitacao_local', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='materia.UnidadeTramitacao', verbose_name='Unidade Local'), - ), - ] diff --git a/sapl/materia/migrations/0027_auto_20160404_1409.py b/sapl/materia/migrations/0027_auto_20160404_1409.py deleted file mode 100644 index ee05c96ab..000000000 --- a/sapl/materia/migrations/0027_auto_20160404_1409.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-04 17:09 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.materia.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0026_auto_20160322_1514'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), - ), - migrations.AlterField( - model_name='proposicao', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original (PDF)'), - ), - ] diff --git a/sapl/materia/migrations/0028_auto_20160419_1000.py b/sapl/materia/migrations/0028_auto_20160419_1000.py deleted file mode 100644 index 579eca291..000000000 --- a/sapl/materia/migrations/0028_auto_20160419_1000.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-19 13:00 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0027_auto_20160404_1409'), - ] - - operations = [ - migrations.AlterField( - model_name='tipomaterialegislativa', - name='num_automatica', - field=models.BooleanField(default=False), - ), - migrations.AlterField( - model_name='tipomaterialegislativa', - name='quorum_minimo_votacao', - field=models.PositiveIntegerField(blank=True, null=True), - ), - ] diff --git a/sapl/materia/migrations/0028_auto_20160419_1056.py b/sapl/materia/migrations/0028_auto_20160419_1056.py deleted file mode 100644 index bd4eb7f22..000000000 --- a/sapl/materia/migrations/0028_auto_20160419_1056.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-19 13:56 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0027_auto_20160404_1409'), - ] - - operations = [ - migrations.AlterField( - model_name='tramitacao', - name='unidade_tramitacao_destino', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'), - ), - migrations.AlterField( - model_name='tramitacao', - name='unidade_tramitacao_local', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local'), - ), - ] diff --git a/sapl/materia/migrations/0029_auto_20160428_1020.py b/sapl/materia/migrations/0029_auto_20160428_1020.py deleted file mode 100644 index 2cdd68c76..000000000 --- a/sapl/materia/migrations/0029_auto_20160428_1020.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-04-28 13:20 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0028_auto_20160419_1000'), - ] - - operations = [ - migrations.AlterField( - model_name='autoria', - name='primeiro_autor', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Primeiro Autor'), - ), - ] diff --git a/sapl/materia/migrations/0029_merge.py b/sapl/materia/migrations/0029_merge.py deleted file mode 100644 index 3a37b2421..000000000 --- a/sapl/materia/migrations/0029_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-04-19 18:02 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0028_auto_20160419_1056'), - ('materia', '0028_auto_20160419_1000'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0030_auto_20160429_1349.py b/sapl/materia/migrations/0030_auto_20160429_1349.py deleted file mode 100644 index cfd764719..000000000 --- a/sapl/materia/migrations/0030_auto_20160429_1349.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-29 16:49 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0029_auto_20160428_1020'), - ] - - operations = [ - migrations.AlterModelOptions( - name='numeracao', - options={'ordering': ('materia', 'tipo_materia', 'numero_materia', 'ano_materia', 'data_materia'), 'verbose_name': 'Numeração', 'verbose_name_plural': 'Numerações'}, - ), - ] diff --git a/sapl/materia/migrations/0030_auto_20160502_1630.py b/sapl/materia/migrations/0030_auto_20160502_1630.py deleted file mode 100644 index 6f8fd60be..000000000 --- a/sapl/materia/migrations/0030_auto_20160502_1630.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-02 19:30 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0029_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='tipo_origem_externa', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tipo_origem_externa_set', to='materia.TipoMateriaLegislativa', verbose_name='Tipo'), - ), - ] diff --git a/sapl/materia/migrations/0031_auto_20160502_1131.py b/sapl/materia/migrations/0031_auto_20160502_1131.py deleted file mode 100644 index a51221080..000000000 --- a/sapl/materia/migrations/0031_auto_20160502_1131.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-02 14:31 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0030_auto_20160429_1349'), - ] - - operations = [ - migrations.AlterField( - model_name='tramitacao', - name='urgente', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Urgente ?'), - ), - ] diff --git a/sapl/materia/migrations/0031_merge.py b/sapl/materia/migrations/0031_merge.py deleted file mode 100644 index 9faf9d45a..000000000 --- a/sapl/materia/migrations/0031_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-03 20:05 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0030_auto_20160429_1349'), - ('materia', '0030_auto_20160502_1630'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0032_auto_20160503_0926.py b/sapl/materia/migrations/0032_auto_20160503_0926.py deleted file mode 100644 index 0ece4f329..000000000 --- a/sapl/materia/migrations/0032_auto_20160503_0926.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-03 12:26 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0031_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='anexada', - name='materia_anexada', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materia_anexada_set', to='materia.MateriaLegislativa'), - ), - migrations.AlterField( - model_name='anexada', - name='materia_principal', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materia_principal_set', to='materia.MateriaLegislativa'), - ), - ] diff --git a/sapl/materia/migrations/0032_merge.py b/sapl/materia/migrations/0032_merge.py deleted file mode 100644 index 8882ae927..000000000 --- a/sapl/materia/migrations/0032_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-09 01:00 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0031_auto_20160502_1131'), - ('materia', '0031_merge'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0033_documentoacessorio_texto_original.py b/sapl/materia/migrations/0033_documentoacessorio_texto_original.py deleted file mode 100644 index 43e89a395..000000000 --- a/sapl/materia/migrations/0033_documentoacessorio_texto_original.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 12:43 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.materia.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0032_merge'), - ] - - operations = [ - migrations.AddField( - model_name='documentoacessorio', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'), - ), - ] diff --git a/sapl/materia/migrations/0034_auto_20160510_0946.py b/sapl/materia/migrations/0034_auto_20160510_0946.py deleted file mode 100644 index eac94fc88..000000000 --- a/sapl/materia/migrations/0034_auto_20160510_0946.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 12:46 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0033_documentoacessorio_texto_original'), - ] - - operations = [ - migrations.RenameField( - model_name='documentoacessorio', - old_name='texto_original', - new_name='arquivo', - ), - ] diff --git a/sapl/materia/migrations/0036_merge.py b/sapl/materia/migrations/0036_merge.py deleted file mode 100644 index f0a9f86a6..000000000 --- a/sapl/materia/migrations/0036_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-19 13:49 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0032_auto_20160503_0926'), - ('materia', '0035_auto_20160510_0949'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0037_auto_20160520_1250.py b/sapl/materia/migrations/0037_auto_20160520_1250.py deleted file mode 100644 index d70ae7dca..000000000 --- a/sapl/materia/migrations/0037_auto_20160520_1250.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-20 15:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.materia.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0036_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), - ), - ] diff --git a/sapl/materia/migrations/0038_auto_20160612_1506.py b/sapl/materia/migrations/0038_auto_20160612_1506.py deleted file mode 100644 index 0ce74f84b..000000000 --- a/sapl/materia/migrations/0038_auto_20160612_1506.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-12 18:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0037_auto_20160520_1250'), - ] - - operations = [ - migrations.AlterField( - model_name='statustramitacao', - name='indicador', - field=models.CharField(blank=True, choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação'), - ), - ] diff --git a/sapl/materia/migrations/0039_auto_20160628_1251.py b/sapl/materia/migrations/0039_auto_20160628_1251.py deleted file mode 100644 index a730729e2..000000000 --- a/sapl/materia/migrations/0039_auto_20160628_1251.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-28 15:51 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import sapl.materia.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('auth', '0007_alter_validators_add_error_messages'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('materia', '0038_auto_20160612_1506'), - ] - - operations = [ - migrations.AddField( - model_name='autor', - name='email', - field=models.EmailField(default=' ', max_length=254, verbose_name='Email'), - preserve_default=False, - ), - migrations.AddField( - model_name='autor', - name='grupo_usuario', - field=models.ForeignKey(default=sapl.materia.models.grupo_autor, on_delete=django.db.models.deletion.CASCADE, to='auth.Group'), - ), - migrations.AddField( - model_name='autor', - name='user', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - ] diff --git a/sapl/materia/migrations/0039_auto_20160808_1753.py b/sapl/materia/migrations/0039_auto_20160808_1753.py deleted file mode 100644 index a7473aa59..000000000 --- a/sapl/materia/migrations/0039_auto_20160808_1753.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-08 20:53 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.materia.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0038_auto_20160612_1506'), - ] - - operations = [ - migrations.RemoveField( - model_name='proposicao', - name='data_devolucao', - ), - migrations.AddField( - model_name='proposicao', - name='data_incorporação', - field=models.DateTimeField(blank=True, null=True, verbose_name='Data de Incorporação'), - ), - migrations.AlterField( - model_name='proposicao', - name='data_recebimento', - field=models.DateTimeField(blank=True, null=True, verbose_name='Data de Recebimento'), - ), - migrations.AlterField( - model_name='proposicao', - name='status', - field=models.CharField(blank=True, choices=[('E', 'Enviada'), ('R', 'Recebida'), ('I', 'Incorporada')], max_length=1, verbose_name='Status Proposição'), - ), - migrations.AlterField( - model_name='proposicao', - name='texto_original', - field=models.FileField(default='', upload_to=sapl.materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), - preserve_default=False, - ), - ] diff --git a/sapl/materia/migrations/0040_auto_20160810_1524.py b/sapl/materia/migrations/0040_auto_20160810_1524.py deleted file mode 100644 index 798bd8a64..000000000 --- a/sapl/materia/migrations/0040_auto_20160810_1524.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-10 18:24 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0039_auto_20160808_1753'), - ] - - operations = [ - migrations.RemoveField( - model_name='proposicao', - name='documento', - ), - migrations.AddField( - model_name='proposicao', - name='documento_gerado', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.DocumentoAcessorio'), - ), - migrations.AddField( - model_name='proposicao', - name='materia_gerada', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='materia_gerada', to='materia.MateriaLegislativa'), - ), - migrations.AlterField( - model_name='proposicao', - name='materia', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='materia_vinculada', to='materia.MateriaLegislativa', verbose_name='Matéria'), - ), - ] diff --git a/sapl/materia/migrations/0041_remove_proposicao_data_incorporação.py b/sapl/materia/migrations/0041_remove_proposicao_data_incorporação.py deleted file mode 100644 index 126ef1687..000000000 --- a/sapl/materia/migrations/0041_remove_proposicao_data_incorporação.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-10 20:02 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0040_auto_20160810_1524'), - ] - - operations = [ - migrations.RemoveField( - model_name='proposicao', - name='data_incorporação', - ), - ] diff --git a/sapl/materia/migrations/0042_proposicao_data_devolução.py b/sapl/materia/migrations/0042_proposicao_data_devolução.py deleted file mode 100644 index cb17864d6..000000000 --- a/sapl/materia/migrations/0042_proposicao_data_devolução.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-10 20:37 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0041_remove_proposicao_data_incorporação'), - ] - - operations = [ - migrations.AddField( - model_name='proposicao', - name='data_devolução', - field=models.DateTimeField(blank=True, null=True, verbose_name='Data de Devolução'), - ), - ] diff --git a/sapl/materia/migrations/0043_auto_20160810_1738.py b/sapl/materia/migrations/0043_auto_20160810_1738.py deleted file mode 100644 index 4012d1162..000000000 --- a/sapl/materia/migrations/0043_auto_20160810_1738.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-08-10 20:38 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0042_proposicao_data_devolução'), - ] - - operations = [ - migrations.RenameField( - model_name='proposicao', - old_name='data_devolução', - new_name='data_devolucao', - ), - ] diff --git a/sapl/materia/migrations/0044_merge.py b/sapl/materia/migrations/0044_merge.py deleted file mode 100644 index 43a6fdb36..000000000 --- a/sapl/materia/migrations/0044_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-22 20:18 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0039_auto_20160628_1251'), - ('materia', '0043_auto_20160810_1738'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0045_auto_20160823_1658.py b/sapl/materia/migrations/0045_auto_20160823_1658.py deleted file mode 100644 index 6c0b8ddbf..000000000 --- a/sapl/materia/migrations/0045_auto_20160823_1658.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-23 19:58 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0044_merge'), - ] - - operations = [ - migrations.RemoveField( - model_name='autor', - name='grupo_usuario', - ), - migrations.AlterField( - model_name='autor', - name='username', - field=models.CharField(blank=True, max_length=50, verbose_name='Nome de Usuário'), - ), - ] diff --git a/sapl/materia/migrations/0046_auto_20160825_1504.py b/sapl/materia/migrations/0046_auto_20160825_1504.py deleted file mode 100644 index 26e078d05..000000000 --- a/sapl/materia/migrations/0046_auto_20160825_1504.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-25 18:04 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0045_auto_20160823_1658'), - ] - - operations = [ - migrations.AlterField( - model_name='autor', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/sapl/materia/migrations/0046_auto_20160825_1833.py b/sapl/materia/migrations/0046_auto_20160825_1833.py deleted file mode 100644 index 25b586eb3..000000000 --- a/sapl/materia/migrations/0046_auto_20160825_1833.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-25 21:33 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0045_auto_20160823_1658'), - ] - - operations = [ - migrations.AlterField( - model_name='autor', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/sapl/materia/migrations/0047_merge.py b/sapl/materia/migrations/0047_merge.py deleted file mode 100644 index dd4fbdfa2..000000000 --- a/sapl/materia/migrations/0047_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-29 16:45 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0046_auto_20160825_1833'), - ('materia', '0046_auto_20160825_1504'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0048_auto_20160927_1254.py b/sapl/materia/migrations/0048_auto_20160927_1254.py deleted file mode 100644 index c229b854a..000000000 --- a/sapl/materia/migrations/0048_auto_20160927_1254.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-27 15:54 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0047_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='autoria', - name='autor', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.Autor', verbose_name='Autor'), - ), - migrations.AlterField( - model_name='autoria', - name='partido', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Partido', verbose_name='Partido'), - ), - ] diff --git a/sapl/materia/migrations/0049_remove_autoria_partido.py b/sapl/materia/migrations/0049_remove_autoria_partido.py deleted file mode 100644 index 6f5002e05..000000000 --- a/sapl/materia/migrations/0049_remove_autoria_partido.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 14:11 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0048_auto_20160927_1254'), - ] - - operations = [ - migrations.RemoveField( - model_name='autoria', - name='partido', - ), - ] diff --git a/sapl/materia/migrations/0050_auto_20161003_0417.py b/sapl/materia/migrations/0050_auto_20161003_0417.py deleted file mode 100644 index 2506b31a9..000000000 --- a/sapl/materia/migrations/0050_auto_20161003_0417.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-03 07:17 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0049_remove_autoria_partido'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tramitacao', - options={'ordering': ('data_tramitacao',), 'verbose_name': 'Tramitação', 'verbose_name_plural': 'Tramitações'}, - ), - ] diff --git a/sapl/materia/migrations/0051_auto_20161004_0927.py b/sapl/materia/migrations/0051_auto_20161004_0927.py deleted file mode 100644 index db4e3349e..000000000 --- a/sapl/materia/migrations/0051_auto_20161004_0927.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-04 12:27 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0050_auto_20161003_0417'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tramitacao', - options={'ordering': ('-data_tramitacao',), 'verbose_name': 'Tramitação', 'verbose_name_plural': 'Tramitações'}, - ), - ] diff --git a/sapl/materia/migrations/0052_auto_20161004_1041.py b/sapl/materia/migrations/0052_auto_20161004_1041.py deleted file mode 100644 index eefa28ea8..000000000 --- a/sapl/materia/migrations/0052_auto_20161004_1041.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-04 13:41 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0051_auto_20161004_0927'), - ] - - operations = [ - migrations.AlterField( - model_name='regimetramitacao', - name='descricao', - field=models.CharField(max_length=50, verbose_name='Descrição'), - ), - ] diff --git a/sapl/materia/migrations/0053_auto_20161004_1854.py b/sapl/materia/migrations/0053_auto_20161004_1854.py deleted file mode 100644 index b9e2bd88a..000000000 --- a/sapl/materia/migrations/0053_auto_20161004_1854.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-04 21:54 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0052_auto_20161004_1041'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tramitacao', - options={'verbose_name': 'Tramitação', 'verbose_name_plural': 'Tramitações'}, - ), - ] diff --git a/sapl/materia/migrations/0054_auto_20161009_1222.py b/sapl/materia/migrations/0054_auto_20161009_1222.py deleted file mode 100644 index 48a12f263..000000000 --- a/sapl/materia/migrations/0054_auto_20161009_1222.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-09 15:22 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -def clear_model_autoria(apps, schema_editor): - Autoria = apps.get_model("materia", "Autoria") - Autoria.objects.all().delete() - Proposicao = apps.get_model("materia", "Proposicao") - Proposicao.objects.all().delete() - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0003_auto_20161009_1222'), - ('materia', '0053_auto_20161004_1854'), - ] - - operations = [ - migrations.RunPython(clear_model_autoria), - migrations.RemoveField( - model_name='autor', - name='comissao', - ), - migrations.RemoveField( - model_name='autor', - name='parlamentar', - ), - migrations.RemoveField( - model_name='autor', - name='partido', - ), - migrations.RemoveField( - model_name='autor', - name='tipo', - ), - migrations.RemoveField( - model_name='autor', - name='user', - ), - migrations.AlterField( - model_name='autoria', - name='autor', - field=models.OneToOneField( - on_delete=django.db.models.deletion.CASCADE, to='base.Autor', verbose_name='Autor'), - ), - migrations.AlterField( - model_name='proposicao', - name='autor', - field=models.ForeignKey( - blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.Autor'), - ), - migrations.DeleteModel( - name='Autor', - ), - migrations.DeleteModel( - name='TipoAutor', - ), - ] diff --git a/sapl/materia/migrations/0054_auto_20161011_0904.py b/sapl/materia/migrations/0054_auto_20161011_0904.py deleted file mode 100644 index c4a2b34bb..000000000 --- a/sapl/materia/migrations/0054_auto_20161011_0904.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 12:04 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0053_auto_20161004_1854'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='em_tramitacao', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Em Tramitação?'), - ), - ] diff --git a/sapl/materia/migrations/0055_auto_20161009_1418.py b/sapl/materia/migrations/0055_auto_20161009_1418.py deleted file mode 100644 index 8168ab4e4..000000000 --- a/sapl/materia/migrations/0055_auto_20161009_1418.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-09 17:18 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('base', '0022_auto_20161009_1222'), - ('materia', '0054_auto_20161009_1222'), - ] - - operations = [ - migrations.AddField( - model_name='materialegislativa', - name='autores', - field=models.ManyToManyField(through='materia.Autoria', to='base.Autor'), - ), - migrations.AlterField( - model_name='autoria', - name='autor', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='base.Autor', verbose_name='Autor'), - ), - migrations.AlterField( - model_name='autoria', - name='materia', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa', verbose_name='Matéria Legislativa'), - ), - ] diff --git a/sapl/materia/migrations/0056_merge.py b/sapl/materia/migrations/0056_merge.py deleted file mode 100644 index 895977296..000000000 --- a/sapl/materia/migrations/0056_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 19:45 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0055_auto_20161009_1418'), - ('materia', '0054_auto_20161011_0904'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0056_remove_tipo_proposicao.py b/sapl/materia/migrations/0056_remove_tipo_proposicao.py deleted file mode 100644 index 42d212c57..000000000 --- a/sapl/materia/migrations/0056_remove_tipo_proposicao.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 19:45 -from __future__ import unicode_literals - -from django.db import migrations - - -def clear_model_tipo_proposicao(apps, schema_editor): - TipoProposicao = apps.get_model("materia", "TipoProposicao") - TipoProposicao.objects.all().delete() - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0056_merge'), - ] - - operations = [ - migrations.RunPython(clear_model_tipo_proposicao), ] diff --git a/sapl/materia/migrations/0057_auto_20161016_0156.py b/sapl/materia/migrations/0057_auto_20161016_0156.py deleted file mode 100644 index 31dad187e..000000000 --- a/sapl/materia/migrations/0057_auto_20161016_0156.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-16 03:56 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -def clear_model_tipo_proposicao(apps, schema_editor): - TipoProposicao = apps.get_model("materia", "TipoProposicao") - TipoProposicao.objects.all().delete() - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('materia', '0056_remove_tipo_proposicao'), - ] - - operations = [ - migrations.RunPython(clear_model_tipo_proposicao), - migrations.RemoveField( - model_name='tipoproposicao', - name='materia_ou_documento', - ), - migrations.RemoveField( - model_name='tipoproposicao', - name='modelo', - ), - migrations.RemoveField( - model_name='tipoproposicao', - name='tipo_documento', - ), - migrations.RemoveField( - model_name='tipoproposicao', - name='tipo_materia', - ), - migrations.AddField( - model_name='tipoproposicao', - name='conteudo', - field=models.ForeignKey( - default=None, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Conteúdo'), - ), - ] diff --git a/sapl/materia/migrations/0058_auto_20161016_0329.py b/sapl/materia/migrations/0058_auto_20161016_0329.py deleted file mode 100644 index caacc710c..000000000 --- a/sapl/materia/migrations/0058_auto_20161016_0329.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-16 05:29 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0057_auto_20161016_0156'), - ] - - operations = [ - migrations.AddField( - model_name='tipoproposicao', - name='object_id', - field=models.PositiveIntegerField(blank=True, default=None, null=True), - ), - migrations.AlterField( - model_name='tipoproposicao', - name='conteudo', - field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Definição de Tipo'), - ), - ] diff --git a/sapl/materia/migrations/0059_auto_20161016_1333.py b/sapl/materia/migrations/0059_auto_20161016_1333.py deleted file mode 100644 index 8ec92f96f..000000000 --- a/sapl/materia/migrations/0059_auto_20161016_1333.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-16 15:33 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0058_auto_20161016_0329'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='tipoproposicao', - unique_together=set([('conteudo', 'object_id')]), - ), - ] diff --git a/sapl/materia/migrations/0060_auto_20161017_0050.py b/sapl/materia/migrations/0060_auto_20161017_0050.py deleted file mode 100644 index ec0cc4d8a..000000000 --- a/sapl/materia/migrations/0060_auto_20161017_0050.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-17 02:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.materia.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0059_auto_20161016_1333'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.materia.models.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), - ), - ] diff --git a/sapl/materia/migrations/0061_auto_20161017_1655.py b/sapl/materia/migrations/0061_auto_20161017_1655.py deleted file mode 100644 index cbe8a0568..000000000 --- a/sapl/materia/migrations/0061_auto_20161017_1655.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-17 18:55 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0060_auto_20161017_0050'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='descricao', - field=models.TextField(verbose_name='Descrição'), - ), - ] diff --git a/sapl/materia/migrations/0062_auto_20161021_1424.py b/sapl/materia/migrations/0062_auto_20161021_1424.py deleted file mode 100644 index c9d8985ea..000000000 --- a/sapl/materia/migrations/0062_auto_20161021_1424.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-21 14:24 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0061_auto_20161017_1655'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='autor', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.Autor'), - ), - migrations.AlterField( - model_name='proposicao', - name='materia', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='materia_vinculada', to='materia.MateriaLegislativa', verbose_name='Matéria Vinculada'), - ), - ] diff --git a/sapl/materia/migrations/0063_auto_20161021_1445.py b/sapl/materia/migrations/0063_auto_20161021_1445.py deleted file mode 100644 index 4a9a8a0dd..000000000 --- a/sapl/materia/migrations/0063_auto_20161021_1445.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-21 14:45 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0062_auto_20161021_1424'), - ] - - operations = [ - migrations.RemoveField( - model_name='proposicao', - name='materia', - ), - migrations.AddField( - model_name='proposicao', - name='materia_vinculada', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='proposicao_set', to='materia.MateriaLegislativa', verbose_name='Matéria Vinculada'), - ), - ] diff --git a/sapl/materia/migrations/0064_auto_20161022_1405.py b/sapl/materia/migrations/0064_auto_20161022_1405.py deleted file mode 100644 index e7db0ecd7..000000000 --- a/sapl/materia/migrations/0064_auto_20161022_1405.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-22 14:05 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('materia', '0063_auto_20161021_1445'), - ] - - operations = [ - migrations.AddField( - model_name='proposicao', - name='content_type', - field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Tipo de Material Gerado'), - ), - migrations.AddField( - model_name='proposicao', - name='materia_de_vinculo', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='proposicao_set', to='materia.MateriaLegislativa', verbose_name='Matéria anexadora'), - ), - migrations.AddField( - model_name='proposicao', - name='object_id', - field=models.PositiveIntegerField(blank=True, default=None, null=True), - ), - migrations.RemoveField( - model_name='proposicao', - name='documento_gerado', - ), - migrations.RemoveField( - model_name='proposicao', - name='materia_gerada', - ), - migrations.RemoveField( - model_name='proposicao', - name='materia_vinculada', - ), - migrations.AlterUniqueTogether( - name='proposicao', - unique_together=set([('content_type', 'object_id')]), - ), - ] diff --git a/sapl/materia/migrations/0065_auto_20161022_1411.py b/sapl/materia/migrations/0065_auto_20161022_1411.py deleted file mode 100644 index ce3a060df..000000000 --- a/sapl/materia/migrations/0065_auto_20161022_1411.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-22 14:11 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0064_auto_20161022_1405'), - ] - - operations = [ - migrations.AlterField( - model_name='proposicao', - name='content_type', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Tipo de Material Gerado'), - ), - ] diff --git a/sapl/materia/migrations/0066_proposicao_ano.py b/sapl/materia/migrations/0066_proposicao_ano.py deleted file mode 100644 index d7152e987..000000000 --- a/sapl/materia/migrations/0066_proposicao_ano.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-22 23:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0065_auto_20161022_1411'), - ] - - operations = [ - migrations.AddField( - model_name='proposicao', - name='ano', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0067_auto_20161025_1630.py b/sapl/materia/migrations/0067_auto_20161025_1630.py deleted file mode 100644 index 93e8eac0c..000000000 --- a/sapl/materia/migrations/0067_auto_20161025_1630.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-25 16:30 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0066_proposicao_ano'), - ] - - operations = [ - migrations.RenameField( - model_name='tipoproposicao', - old_name='conteudo', - new_name='content_type', - ), - migrations.AlterUniqueTogether( - name='tipoproposicao', - unique_together=set([('content_type', 'object_id')]), - ), - ] diff --git a/sapl/materia/migrations/0068_auto_20161110_0910.py b/sapl/materia/migrations/0068_auto_20161110_0910.py deleted file mode 100644 index 5d4bc7b36..000000000 --- a/sapl/materia/migrations/0068_auto_20161110_0910.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-10 09:10 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0067_auto_20161025_1630'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano'), - ), - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='proposicao', - name='ano', - field=models.PositiveSmallIntegerField(blank=True, choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0069_tipoproposicao_perfis.py b/sapl/materia/migrations/0069_tipoproposicao_perfis.py deleted file mode 100644 index e6bcb3076..000000000 --- a/sapl/materia/migrations/0069_tipoproposicao_perfis.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-11 10:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0069_auto_20161107_1932'), - ('materia', '0068_auto_20161110_0910'), - ] - - operations = [ - migrations.AddField( - model_name='tipoproposicao', - name='perfis', - field=models.ManyToManyField(blank=True, to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfis Estruturais de Textos Articulados'), - ), - ] diff --git a/sapl/materia/migrations/0070_auto_20161111_1301.py b/sapl/materia/migrations/0070_auto_20161111_1301.py deleted file mode 100644 index 38a53d9cd..000000000 --- a/sapl/materia/migrations/0070_auto_20161111_1301.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-11 13:01 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0069_tipoproposicao_perfis'), - ] - - operations = [ - migrations.AlterField( - model_name='tipoproposicao', - name='perfis', - field=models.ManyToManyField(blank=True, help_text='\n Mesmo que em Configurações da Aplicação nas\n Tabelas Auxiliares esteja definido que Proposições possam\n utilizar Textos Articulados, ao gerar uma proposição,\n a solução de Textos Articulados será disponibilizada se\n o Tipo escolhido para a Proposição estiver associado a ao\n menos um Perfil Estrutural de Texto Articulado.\n ', - to='compilacao.PerfilEstruturalTextoArticulado', verbose_name='Perfis Estruturais de Textos Articulados'), - ), - ] diff --git a/sapl/materia/migrations/0071_auto_20161130_1001.py b/sapl/materia/migrations/0071_auto_20161130_1001.py deleted file mode 100644 index c1b688121..000000000 --- a/sapl/materia/migrations/0071_auto_20161130_1001.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2016-11-30 10:01 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0070_auto_20161111_1301'), - ] - - operations = [ - migrations.AlterModelOptions( - name='proposicao', - options={'permissions': (('detail_proposicao_enviada', 'Pode acessar detalhes de uma proposição enviada.'), ('detail_proposicao_devolvida', 'Pode acessar detalhes de uma proposição devolvida.')), 'verbose_name': 'Proposição', 'verbose_name_plural': 'Proposições'}, - ), - ] diff --git a/sapl/materia/migrations/0072_auto_20161130_1618.py b/sapl/materia/migrations/0072_auto_20161130_1618.py deleted file mode 100644 index da265d3ff..000000000 --- a/sapl/materia/migrations/0072_auto_20161130_1618.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2016-11-30 16:18 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0071_auto_20161130_1001'), - ] - - operations = [ - migrations.AlterModelOptions( - name='proposicao', - options={'permissions': (('detail_proposicao_enviada', 'Pode acessar detalhes de uma proposição enviada.'), ('detail_proposicao_devolvida', 'Pode acessar detalhes de uma proposição devolvida.'), ('detail_proposicao_incorporada', 'Pode acessar detalhes de uma proposição incorporada.')), 'verbose_name': 'Proposição', 'verbose_name_plural': 'Proposições'}, - ), - ] diff --git a/sapl/materia/migrations/0073_auto_20161216_1640.py b/sapl/materia/migrations/0073_auto_20161216_1640.py deleted file mode 100644 index 55717d87d..000000000 --- a/sapl/materia/migrations/0073_auto_20161216_1640.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2016-12-16 16:40 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0072_auto_20161130_1618'), - ] - - operations = [ - migrations.AlterModelOptions( - name='statustramitacao', - options={'ordering': ['descricao'], 'verbose_name': 'Status de Tramitação', 'verbose_name_plural': 'Status de Tramitação'}, - ), - migrations.AlterModelOptions( - name='tipomaterialegislativa', - options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Matéria Legislativa', 'verbose_name_plural': 'Tipos de Matérias Legislativas'}, - ), - ] diff --git a/sapl/materia/migrations/0074_auto_20170102_0951.py b/sapl/materia/migrations/0074_auto_20170102_0951.py deleted file mode 100644 index 12422eeb8..000000000 --- a/sapl/materia/migrations/0074_auto_20170102_0951.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-02 09:51 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0073_auto_20161216_1640'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano'), - ), - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='proposicao', - name='ano', - field=models.PositiveSmallIntegerField(blank=True, choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0075_auto_20170123_1548.py b/sapl/materia/migrations/0075_auto_20170123_1548.py deleted file mode 100644 index 7a1ca66ea..000000000 --- a/sapl/materia/migrations/0075_auto_20170123_1548.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-23 15:48 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0074_auto_20170102_0951'), - ] - - operations = [ - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano'), - ), - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='proposicao', - name='ano', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0075_auto_20170203_1019.py b/sapl/materia/migrations/0075_auto_20170203_1019.py deleted file mode 100644 index c8e5e5887..000000000 --- a/sapl/materia/migrations/0075_auto_20170203_1019.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-03 10:19 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0074_auto_20170102_0951'), - ] - - operations = [ - migrations.AlterField( - model_name='autoria', - name='primeiro_autor', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Primeiro Autor'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='ano_origem_externa', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], null=True, verbose_name='Ano'), - ), - migrations.AlterField( - model_name='materialegislativa', - name='texto_original', - field=models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'), - ), - migrations.AlterField( - model_name='numeracao', - name='ano_materia', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='proposicao', - name='ano', - field=models.PositiveSmallIntegerField(blank=True, choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], default=None, null=True, verbose_name='Ano'), - ), - ] diff --git a/sapl/materia/migrations/0076_merge.py b/sapl/materia/migrations/0076_merge.py deleted file mode 100644 index 49ae8f130..000000000 --- a/sapl/materia/migrations/0076_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-03 16:34 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0075_auto_20170203_1019'), - ('materia', '0075_auto_20170123_1548'), - ] - - operations = [ - ] diff --git a/sapl/materia/migrations/0077_auto_20170321_1130.py b/sapl/materia/migrations/0077_auto_20170321_1130.py deleted file mode 100644 index a39b48c1d..000000000 --- a/sapl/materia/migrations/0077_auto_20170321_1130.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-21 11:30 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0076_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='relatoria', - name='comissao', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='comissoes.Comissao', verbose_name='Comissão'), - ), - ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 488a4e555..b5390f3b4 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -4,8 +4,8 @@ import reversion from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ObjectDoesNotExist from django.db import models -from django.db.models.deletion import PROTECT from django.utils import formats from django.utils.translation import ugettext_lazy as _ from model_utils import Choices @@ -38,6 +38,7 @@ class TipoProposicao(models.Model): # FIXME - para a rotina de migração - estes campos mudaram # retire o comentário quando resolver content_type = models.ForeignKey(ContentType, default=None, + on_delete=models.PROTECT, verbose_name=_('Definição de Tipo')) object_id = models.PositiveIntegerField( blank=True, null=True, default=None) @@ -123,7 +124,9 @@ TIPO_APRESENTACAO_CHOICES = Choices(('O', 'oral', _('Oral')), @reversion.register() class MateriaLegislativa(models.Model): - tipo = models.ForeignKey(TipoMateriaLegislativa, verbose_name=_('Tipo')) + tipo = models.ForeignKey(TipoMateriaLegislativa, + on_delete=models.PROTECT, + verbose_name=_('Tipo')) numero = models.PositiveIntegerField(verbose_name=_('Número')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'), choices=RANGE_ANOS) @@ -135,7 +138,9 @@ class MateriaLegislativa(models.Model): verbose_name=_('Tipo de Apresentação'), choices=TIPO_APRESENTACAO_CHOICES) regime_tramitacao = models.ForeignKey( - RegimeTramitacao, verbose_name=_('Regime Tramitação')) + RegimeTramitacao, + on_delete=models.PROTECT, + verbose_name=_('Regime Tramitação')) data_publicacao = models.DateField( blank=True, null=True, verbose_name=_('Data Publicação')) tipo_origem_externa = models.ForeignKey( @@ -143,6 +148,7 @@ class MateriaLegislativa(models.Model): blank=True, null=True, related_name='tipo_origem_externa_set', + on_delete=models.PROTECT, verbose_name=_('Tipo')) numero_origem_externa = models.CharField( max_length=5, blank=True, verbose_name=_('Número')) @@ -151,7 +157,8 @@ class MateriaLegislativa(models.Model): data_origem_externa = models.DateField( blank=True, null=True, verbose_name=_('Data')) local_origem_externa = models.ForeignKey( - Origem, blank=True, null=True, verbose_name=_('Local Origem')) + Origem, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Local Origem')) apelido = models.CharField( max_length=50, blank=True, verbose_name=_('Apelido')) dias_prazo = models.PositiveIntegerField( @@ -209,6 +216,22 @@ class MateriaLegislativa(models.Model): return _('%(tipo)s nº %(numero)s de %(ano)s') % { 'tipo': self.tipo, 'numero': self.numero, 'ano': self.ano} + def data_entrada_protocolo(self): + ''' + hack: recuperar a data de entrada do protocolo sem gerar + dependência circular + ''' + from sapl.protocoloadm.models import Protocolo + if self.ano and self.numero_protocolo: + try: + return Protocolo.objects.get( + ano=self.ano, + numero=self.numero_protocolo).data + except ObjectDoesNotExist: + pass + + return '' + def delete(self, using=None, keep_parents=False): if self.texto_original: self.texto_original.delete() @@ -236,9 +259,12 @@ class MateriaLegislativa(models.Model): @reversion.register() class Autoria(models.Model): - autor = models.ForeignKey(Autor, verbose_name=_('Autor')) + autor = models.ForeignKey(Autor, + verbose_name=_('Autor'), + on_delete=models.PROTECT) materia = models.ForeignKey( - MateriaLegislativa, verbose_name=_('Matéria Legislativa')) + MateriaLegislativa, on_delete=models.PROTECT, + verbose_name=_('Matéria Legislativa')) primeiro_autor = models.BooleanField(verbose_name=_('Primeiro Autor'), choices=YES_NO_CHOICES, default=False) @@ -255,7 +281,7 @@ class Autoria(models.Model): @reversion.register() class AcompanhamentoMateria(models.Model): usuario = models.CharField(max_length=50) - materia = models.ForeignKey(MateriaLegislativa) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) email = models.EmailField( max_length=100, verbose_name=_('E-mail')) data_cadastro = models.DateField(auto_now_add=True) @@ -275,9 +301,11 @@ class AcompanhamentoMateria(models.Model): @reversion.register() class Anexada(models.Model): materia_principal = models.ForeignKey( - MateriaLegislativa, related_name='materia_principal_set') + MateriaLegislativa, related_name='materia_principal_set', + on_delete=models.PROTECT) materia_anexada = models.ForeignKey( - MateriaLegislativa, related_name='materia_anexada_set') + MateriaLegislativa, related_name='materia_anexada_set', + on_delete=models.PROTECT) data_anexacao = models.DateField(verbose_name=_('Data Anexação')) data_desanexacao = models.DateField( blank=True, null=True, verbose_name=_('Data Desanexação')) @@ -295,8 +323,13 @@ class Anexada(models.Model): @reversion.register() class AssuntoMateria(models.Model): - assunto = models.CharField(max_length=200) - dispositivo = models.CharField(max_length=50) + assunto = models.CharField( + max_length=50, + verbose_name=_('Assunto')) + dispositivo = models.CharField( + max_length=200, + blank=True, + verbose_name=_('Descrição do Dispositivo Legal')) class Meta: verbose_name = _('Assunto de Matéria') @@ -311,8 +344,8 @@ class DespachoInicial(models.Model): # TODO M2M? # TODO Despachos não são necessáriamente comissoes, podem ser outros # órgãos, ex: procuradorias - materia = models.ForeignKey(MateriaLegislativa) - comissao = models.ForeignKey(Comissao) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) + comissao = models.ForeignKey(Comissao, on_delete=models.PROTECT) class Meta: verbose_name = _('Despacho Inicial') @@ -346,9 +379,11 @@ class TipoDocumento(models.Model): @reversion.register() class DocumentoAcessorio(models.Model): - materia = models.ForeignKey(MateriaLegislativa) - tipo = models.ForeignKey(TipoDocumento, verbose_name=_('Tipo')) - nome = models.CharField(max_length=30, verbose_name=_('Nome')) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) + tipo = models.ForeignKey(TipoDocumento, + on_delete=models.PROTECT, + verbose_name=_('Tipo')) + nome = models.CharField(max_length=50, verbose_name=_('Nome')) data = models.DateField(blank=True, null=True, verbose_name=_('Data')) autor = models.CharField( max_length=50, blank=True, verbose_name=_('Autor')) @@ -400,8 +435,14 @@ class DocumentoAcessorio(models.Model): @reversion.register() class MateriaAssunto(models.Model): # TODO M2M ?? - assunto = models.ForeignKey(AssuntoMateria) - materia = models.ForeignKey(MateriaLegislativa) + assunto = models.ForeignKey( + AssuntoMateria, + on_delete=models.PROTECT, + verbose_name=_('Assunto')) + materia = models.ForeignKey( + MateriaLegislativa, + on_delete=models.PROTECT, + verbose_name=_('Matéria')) class Meta: verbose_name = _('Relação Matéria - Assunto') @@ -414,9 +455,11 @@ class MateriaAssunto(models.Model): @reversion.register() class Numeracao(models.Model): - materia = models.ForeignKey(MateriaLegislativa) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) tipo_materia = models.ForeignKey( - TipoMateriaLegislativa, verbose_name=_('Tipo de Matéria')) + TipoMateriaLegislativa, + on_delete=models.PROTECT, + verbose_name=_('Tipo de Matéria')) numero_materia = models.CharField(max_length=5, verbose_name=_('Número')) ano_materia = models.PositiveSmallIntegerField(verbose_name=_('Ano'), @@ -481,15 +524,19 @@ class TipoFimRelatoria(models.Model): @reversion.register() class Relatoria(models.Model): - materia = models.ForeignKey(MateriaLegislativa) - parlamentar = models.ForeignKey(Parlamentar, verbose_name=_('Parlamentar')) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, + on_delete=models.PROTECT, + verbose_name=_('Parlamentar')) tipo_fim_relatoria = models.ForeignKey( TipoFimRelatoria, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Motivo Fim Relatoria')) comissao = models.ForeignKey( - Comissao, blank=True, null=True, verbose_name=_('Comissão')) + Comissao, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Comissão')) data_designacao_relator = models.DateField( verbose_name=_('Data Designação')) data_destituicao_relator = models.DateField( @@ -508,8 +555,8 @@ class Relatoria(models.Model): @reversion.register() class Parecer(models.Model): - relatoria = models.ForeignKey(Relatoria) - materia = models.ForeignKey(MateriaLegislativa) + relatoria = models.ForeignKey(Relatoria, on_delete=models.PROTECT) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) tipo_conclusao = models.CharField(max_length=3, blank=True) tipo_apresentacao = models.CharField( max_length=1, choices=TIPO_APRESENTACAO_CHOICES) @@ -527,8 +574,12 @@ class Parecer(models.Model): @reversion.register() class Proposicao(models.Model): - autor = models.ForeignKey(Autor, null=True, blank=True, on_delete=PROTECT) - tipo = models.ForeignKey(TipoProposicao, verbose_name=_('Tipo')) + autor = models.ForeignKey(Autor, + null=True, + blank=True, + on_delete=models.PROTECT) + tipo = models.ForeignKey(TipoProposicao, on_delete=models.PROTECT, + verbose_name=_('Tipo')) # XXX data_envio was not null, but actual data said otherwise!!! data_envio = models.DateTimeField( @@ -587,6 +638,7 @@ class Proposicao(models.Model): # retire o comentário quando resolver materia_de_vinculo = models.ForeignKey( MateriaLegislativa, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Matéria anexadora'), related_name=_('proposicao_set')) @@ -633,9 +685,19 @@ class Proposicao(models.Model): ) def __str__(self): - return '%s %s/%s' % (Proposicao._meta.verbose_name, - self.numero_proposicao, - self.ano) + if self.ano and self.numero_proposicao: + return '%s %s/%s' % (Proposicao._meta.verbose_name, + self.numero_proposicao, + self.ano) + else: + if len(self.descricao) < 30: + descricao = self.descricao[:28] + ' ...' + else: + descricao = self.descricao + + return '%s %s/%s' % (Proposicao._meta.verbose_name, + self.id, + descricao) def delete(self, using=None, keep_parents=False): if self.texto_original: @@ -687,11 +749,14 @@ class StatusTramitacao(models.Model): @reversion.register() class UnidadeTramitacao(models.Model): comissao = models.ForeignKey( - Comissao, blank=True, null=True, verbose_name=_('Comissão')) + Comissao, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Comissão')) orgao = models.ForeignKey( - Orgao, blank=True, null=True, verbose_name=_('Órgão')) + Orgao, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Órgão')) parlamentar = models.ForeignKey( - Parlamentar, blank=True, null=True, verbose_name=_('Parlamentar')) + Parlamentar, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Parlamentar')) class Meta: verbose_name = _('Unidade de Tramitação') @@ -736,18 +801,21 @@ class Tramitacao(models.Model): ('C', 'segunda_terceira_votacao', _('2ª e 3ª Votação')), ) - status = models.ForeignKey(StatusTramitacao, verbose_name=_('Status')) - materia = models.ForeignKey(MateriaLegislativa) + status = models.ForeignKey(StatusTramitacao, on_delete=models.PROTECT, + verbose_name=_('Status')) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) data_tramitacao = models.DateField(verbose_name=_('Data Tramitação')) unidade_tramitacao_local = models.ForeignKey( UnidadeTramitacao, related_name='tramitacoes_origem', + on_delete=models.PROTECT, verbose_name=_('Unidade Local')) data_encaminhamento = models.DateField( blank=True, null=True, verbose_name=_('Data Encaminhamento')) unidade_tramitacao_destino = models.ForeignKey( UnidadeTramitacao, related_name='tramitacoes_destino', + on_delete=models.PROTECT, verbose_name=_('Unidade Destino')) urgente = models.BooleanField(verbose_name=_('Urgente ?'), choices=YES_NO_CHOICES) diff --git a/sapl/materia/signals.py b/sapl/materia/signals.py new file mode 100644 index 000000000..9f08b104c --- /dev/null +++ b/sapl/materia/signals.py @@ -0,0 +1,10 @@ +from django.db.models.signals import post_delete, post_save +from sapl.utils import save_texto, delete_texto + +from .models import DocumentoAcessorio, MateriaLegislativa + + +post_save.connect(save_texto, sender=MateriaLegislativa) +post_save.connect(save_texto, sender=DocumentoAcessorio) +post_delete.connect(delete_texto, sender=MateriaLegislativa) +post_delete.connect(delete_texto, sender=DocumentoAcessorio) diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index 9f774a3d3..7eac42e5c 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -4,11 +4,12 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, AcompanhamentoExcluirView, AcompanhamentoMateriaView, AdicionarVariasAutorias, AnexadaCrud, - AutoriaCrud, ConfirmarProposicao, - CriarProtocoloMateriaView, DespachoInicialCrud, - DocumentoAcessorioCrud, + AssuntoMateriaCrud, AutoriaCrud, + ConfirmarProposicao, CriarProtocoloMateriaView, + DespachoInicialCrud, DocumentoAcessorioCrud, DocumentoAcessorioEmLoteView, - LegislacaoCitadaCrud, MateriaLegislativaCrud, + LegislacaoCitadaCrud, MateriaAssuntoCrud, + MateriaLegislativaCrud, MateriaLegislativaPesquisaView, MateriaTaView, NumeracaoCrud, OrgaoCrud, OrigemCrud, PrimeiraTramitacaoEmLoteView, ProposicaoCrud, @@ -31,6 +32,7 @@ urlpatterns_materia = [ AnexadaCrud.get_urls() + AutoriaCrud.get_urls() + DespachoInicialCrud.get_urls() + + MateriaAssuntoCrud.get_urls() + NumeracaoCrud.get_urls() + LegislacaoCitadaCrud.get_urls() + TramitacaoCrud.get_urls() + @@ -97,6 +99,8 @@ urlpatterns_proposicao = [ ] urlpatterns_sistema = [ + url(r'^sistema/assunto-materia', + include(AssuntoMateriaCrud.get_urls())), url(r'^sistema/proposicao/tipo/', include(TipoProposicaoCrud.get_urls())), url(r'^sistema/materia/tipo/', include(TipoMateriaCrud.get_urls())), diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 8a401b079..b93d81289 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -24,8 +24,7 @@ from django_filters.views import FilterView import sapl from sapl.base.models import Autor, CasaLegislativa from sapl.comissoes.models import Comissao, Participacao -from sapl.compilacao.models import (STATUS_TA_EDITION, - STATUS_TA_IMMUTABLE_RESTRICT, +from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, STATUS_TA_PRIVATE) from sapl.compilacao.views import IntegracaoTaView from sapl.crispy_layout_mixin import SaplFormLayout, form_actions @@ -37,7 +36,6 @@ from sapl.materia.forms import (AnexadaForm, ConfirmarProposicaoForm, LegislacaoCitadaForm, ProposicaoForm, TipoProposicaoForm) from sapl.norma.models import LegislacaoCitada -from sapl.parlamentares.models import Parlamentar from sapl.protocoloadm.models import Protocolo from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, autor_modal, gerar_hash_arquivo, get_base_url, @@ -45,18 +43,21 @@ from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, AdicionarVariasAutoriasFilterSet, DespachoInicialForm, - DocumentoAcessorioForm, MateriaLegislativaFilterSet, - MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet, - ReceberProposicaoForm, RelatoriaForm, - TramitacaoEmLoteFilterSet, filtra_tramitacao_destino, + DocumentoAcessorioForm, MateriaAssuntoForm, + MateriaLegislativaFilterSet, MateriaSimplificadaForm, + PrimeiraTramitacaoEmLoteFilterSet, ReceberProposicaoForm, + RelatoriaForm, TramitacaoEmLoteFilterSet, + filtra_tramitacao_destino, filtra_tramitacao_destino_and_status, filtra_tramitacao_status) -from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, - DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao, - Origem, Proposicao, RegimeTramitacao, Relatoria, - StatusTramitacao, TipoDocumento, TipoFimRelatoria, - TipoMateriaLegislativa, TipoProposicao, Tramitacao, - UnidadeTramitacao) +from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, + DespachoInicial, DocumentoAcessorio, MateriaAssunto, + MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao, + RegimeTramitacao, Relatoria, StatusTramitacao, + TipoDocumento, TipoFimRelatoria, TipoMateriaLegislativa, + TipoProposicao, Tramitacao, UnidadeTramitacao) + +AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia') OrigemCrud = Crud.build(Origem, '') @@ -417,7 +418,8 @@ class ReceberProposicao(PermissionRequiredForAppCrudMixin, FormView): else: hasher = gerar_hash_arquivo( proposicao.texto_original.path, - str(proposicao.pk)) if proposicao.texto_original else None + str(proposicao.pk)) \ + if proposicao.texto_original else None if hasher == form.cleaned_data['cod_hash']: return HttpResponseRedirect( reverse('sapl.materia:proposicao-confirmar', @@ -1111,6 +1113,31 @@ class AnexadaCrud(MasterDetailCrud): return 'AnexadaDetail' +class MateriaAssuntoCrud(MasterDetailCrud): + model = MateriaAssunto + parent_field = 'materia' + help_path = '' + public = [RP_LIST, RP_DETAIL] + + class BaseMixin(MasterDetailCrud.BaseMixin): + list_field_names = ['assunto', 'materia'] + + class CreateView(MasterDetailCrud.CreateView): + form_class = MateriaAssuntoForm + + def get_initial(self): + self.initial['materia'] = self.kwargs['pk'] + return self.initial + + class UpdateView(MasterDetailCrud.UpdateView): + form_class = MateriaAssuntoForm + + def get_initial(self): + self.initial['materia'] = self.get_object().materia + self.initial['assunto'] = self.get_object().assunto + return self.initial + + class MateriaLegislativaCrud(Crud): model = MateriaLegislativa help_path = 'materia_legislativa' diff --git a/sapl/norma/apps.py b/sapl/norma/apps.py index effd4f271..c4d55ade0 100644 --- a/sapl/norma/apps.py +++ b/sapl/norma/apps.py @@ -6,3 +6,6 @@ class AppConfig(apps.AppConfig): name = 'sapl.norma' label = 'norma' verbose_name = _('Norma Jurídica') + + def ready(self): + from . import signals diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index 932431d0d..af2b8b38b 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -143,7 +143,7 @@ class NormaJuridicaForm(ModelForm): if texto_integral: if texto_integral.size > MAX_DOC_UPLOAD_SIZE: raise ValidationError("Arquivo muito grande. ( > 5mb )") - return texto_integral + return texto_integral def save(self, commit=False): norma = self.instance diff --git a/sapl/norma/legacy.yaml b/sapl/norma/legacy.yaml index 17a7f083d..3294561b8 100644 --- a/sapl/norma/legacy.yaml +++ b/sapl/norma/legacy.yaml @@ -42,8 +42,6 @@ LegislacaoCitada: subsecao: des_subsecao titulo: des_titulo -# TODO Descomentar quando a issue #832 for concluida -# TipoVinculoNormaJuridica (VinculoNormaJuridica): -# norma_referente: cod_norma_referente -# norma_referida: cod_norma_referida -# tipo_vinculo: tip_vinculo +NormaRelacionada (VinculoNormaJuridica): + norma_principal: cod_norma_referente + norma_relacionada: cod_norma_referida diff --git a/sapl/norma/migrations/0001_initial.py b/sapl/norma/migrations/0001_initial.py index 1e3be4b19..5ccc01658 100644 --- a/sapl/norma/migrations/0001_initial.py +++ b/sapl/norma/migrations/0001_initial.py @@ -1,11 +1,16 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion +import sapl.utils class Migration(migrations.Migration): + initial = True + dependencies = [ ('materia', '0001_initial'), ] @@ -14,98 +19,118 @@ class Migration(migrations.Migration): migrations.CreateModel( name='AssuntoNorma', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('assunto', models.CharField(max_length=50, verbose_name='Assunto')), - ('descricao', models.CharField(blank=True, max_length=250, null=True, verbose_name='Descrição')), + ('descricao', models.CharField(blank=True, max_length=250, verbose_name='Descrição')), ], options={ - 'verbose_name_plural': 'Assuntos de Norma', 'verbose_name': 'Assunto de Norma', + 'verbose_name_plural': 'Assuntos de Norma', }, ), migrations.CreateModel( name='LegislacaoCitada', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('disposicoes', models.CharField(blank=True, max_length=15, null=True, verbose_name='Disposição')), - ('parte', models.CharField(blank=True, max_length=8, null=True, verbose_name='Parte')), - ('livro', models.CharField(blank=True, max_length=7, null=True, verbose_name='Livro')), - ('titulo', models.CharField(blank=True, max_length=7, null=True, verbose_name='Título')), - ('capitulo', models.CharField(blank=True, max_length=7, null=True, verbose_name='Capítulo')), - ('secao', models.CharField(blank=True, max_length=7, null=True, verbose_name='Seção')), - ('subsecao', models.CharField(blank=True, max_length=7, null=True, verbose_name='Subseção')), - ('artigo', models.CharField(blank=True, max_length=4, null=True, verbose_name='Artigo')), - ('paragrafo', models.CharField(blank=True, max_length=3, null=True, verbose_name='Parágrafo')), - ('inciso', models.CharField(blank=True, max_length=10, null=True, verbose_name='Inciso')), - ('alinea', models.CharField(blank=True, max_length=3, null=True, verbose_name='Alínea')), - ('item', models.CharField(blank=True, max_length=3, null=True, verbose_name='Item')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('disposicoes', models.CharField(blank=True, max_length=15, verbose_name='Disposição')), + ('parte', models.CharField(blank=True, max_length=8, verbose_name='Parte')), + ('livro', models.CharField(blank=True, max_length=7, verbose_name='Livro')), + ('titulo', models.CharField(blank=True, max_length=7, verbose_name='Título')), + ('capitulo', models.CharField(blank=True, max_length=7, verbose_name='Capítulo')), + ('secao', models.CharField(blank=True, max_length=7, verbose_name='Seção')), + ('subsecao', models.CharField(blank=True, max_length=7, verbose_name='Subseção')), + ('artigo', models.CharField(blank=True, max_length=4, verbose_name='Artigo')), + ('paragrafo', models.CharField(blank=True, max_length=3, verbose_name='Parágrafo')), + ('inciso', models.CharField(blank=True, max_length=10, verbose_name='Inciso')), + ('alinea', models.CharField(blank=True, max_length=3, verbose_name='Alínea')), + ('item', models.CharField(blank=True, max_length=3, verbose_name='Item')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), ], options={ - 'verbose_name_plural': 'Matérias Legislativas', - 'verbose_name': 'Matéria Legislativa', + 'verbose_name': 'Legislação', + 'verbose_name_plural': 'Legislações', }, ), migrations.CreateModel( name='NormaJuridica', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero', models.IntegerField(verbose_name='Número')), - ('ano', models.SmallIntegerField(verbose_name='Ano')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('texto_integral', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, verbose_name='Texto Integral')), + ('numero', models.CharField(max_length=8, verbose_name='Número')), + ('ano', models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')), ('esfera_federacao', models.CharField(choices=[('E', 'Estadual'), ('F', 'Federal'), ('M', 'Municipal')], max_length=1, verbose_name='Esfera Federação')), - ('data', models.DateField(blank=True, null=True, verbose_name='Data')), + ('data', models.DateField(verbose_name='Data')), ('data_publicacao', models.DateField(blank=True, null=True, verbose_name='Data Publicação')), - ('veiculo_publicacao', models.CharField(blank=True, max_length=30, null=True, verbose_name='Veículo Publicação')), - ('pagina_inicio_publicacao', models.IntegerField(blank=True, null=True, verbose_name='Pg. Início')), - ('pagina_fim_publicacao', models.IntegerField(blank=True, null=True, verbose_name='Pg. Fim')), + ('veiculo_publicacao', models.CharField(blank=True, max_length=30, verbose_name='Veículo Publicação')), + ('pagina_inicio_publicacao', models.PositiveIntegerField(blank=True, null=True, verbose_name='Pg. Início')), + ('pagina_fim_publicacao', models.PositiveIntegerField(blank=True, null=True, verbose_name='Pg. Fim')), ('ementa', models.TextField(verbose_name='Ementa')), - ('indexacao', models.TextField(blank=True, null=True, verbose_name='Indexação')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Observação')), - ('complemento', models.NullBooleanField(verbose_name='Complementar ?')), + ('indexacao', models.TextField(blank=True, verbose_name='Indexação')), + ('observacao', models.TextField(blank=True, verbose_name='Observação')), + ('complemento', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Complementar ?')), ('data_vigencia', models.DateField(blank=True, null=True)), ('timestamp', models.DateTimeField()), - ('assunto', models.ForeignKey(to='norma.AssuntoNorma')), - ('materia', models.ForeignKey(blank=True, null=True, to='materia.MateriaLegislativa')), + ('assuntos', models.ManyToManyField(blank=True, to='norma.AssuntoNorma', verbose_name='Assuntos')), + ('materia', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa', verbose_name='Matéria')), ], options={ - 'verbose_name_plural': 'Normas Jurídicas', + 'ordering': ['-data', '-numero'], 'verbose_name': 'Norma Jurídica', + 'verbose_name_plural': 'Normas Jurídicas', + }, + ), + migrations.CreateModel( + name='NormaRelacionada', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('norma_principal', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='norma_principal', to='norma.NormaJuridica', verbose_name='Norma Principal')), + ('norma_relacionada', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='norma_relacionada', to='norma.NormaJuridica', verbose_name='Norma Relacionada')), + ], + options={ + 'verbose_name': 'Norma Relacionada', + 'verbose_name_plural': 'Normas Relacionadas', }, ), migrations.CreateModel( name='TipoNormaJuridica', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('equivalente_lexml', models.CharField(blank=True, max_length=50, null=True, verbose_name='Equivalente LexML', choices=[('constituicao', 'constituicao'), ('ementa.constitucional', 'ementa.constitucional'), ('lei.complementar', 'lei.complementar'), ('lei.delegada', 'lei.delegada'), ('lei', 'lei'), ('decreto.lei', 'decreto.lei'), ('medida.provisoria', 'medida.provisoria'), ('decreto', 'decreto'), ('lei.organica', 'lei.organica'), ('emenda.lei.organica', 'emenda.lei.organica'), ('decreto.legislativo', 'decreto.legislativo'), ('resolucao', 'resolucao'), ('regimento.interno', 'regimento.interno')])), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('equivalente_lexml', models.CharField(blank=True, choices=[('constituicao', 'constituicao'), ('ementa.constitucional', 'ementa.constitucional'), ('lei.complementar', 'lei.complementar'), ('lei.delegada', 'lei.delegada'), ('lei', 'lei'), ('decreto.lei', 'decreto.lei'), ('medida.provisoria', 'medida.provisoria'), ('decreto', 'decreto'), ('lei.organica', 'lei.organica'), ('emenda.lei.organica', 'emenda.lei.organica'), ('decreto.legislativo', 'decreto.legislativo'), ('resolucao', 'resolucao'), ('regimento.interno', 'regimento.interno')], max_length=50, verbose_name='Equivalente LexML')), ('sigla', models.CharField(max_length=3, verbose_name='Sigla')), ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), ], options={ - 'verbose_name_plural': 'Tipos de Norma Jurídica', + 'ordering': ['descricao'], 'verbose_name': 'Tipo de Norma Jurídica', + 'verbose_name_plural': 'Tipos de Norma Jurídica', }, ), migrations.CreateModel( - name='VinculoNormaJuridica', + name='TipoVinculoNormaJuridica', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('tipo_vinculo', models.CharField(blank=True, max_length=1, null=True, choices=[('A', 'Altera a norma'), ('R', 'Revoga a norma'), ('P', 'Revoga parcialmente a norma'), ('T', 'Revoga por consolidação a norma'), ('C', 'Norma correlata'), ('I', 'Suspende a execução da norma'), ('G', 'Regulamenta a norma')])), - ('norma_referente', models.ForeignKey(to='norma.NormaJuridica', related_name='+')), - ('norma_referida', models.ForeignKey(to='norma.NormaJuridica', related_name='+')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sigla', models.CharField(blank=True, max_length=1, verbose_name='Sigla')), + ('descricao_ativa', models.CharField(blank=True, max_length=50, verbose_name='Descrição Ativa')), + ('descricao_passiva', models.CharField(blank=True, max_length=50, verbose_name='Descrição Passiva')), ], options={ - 'verbose_name_plural': 'Vínculos entre Normas Jurídicas', - 'verbose_name': 'Vínculo entre Normas Jurídicas', + 'verbose_name': 'Tipo de Vínculo entre Normas Jurídicas', + 'verbose_name_plural': 'Tipos de Vínculos entre Normas Jurídicas', }, ), + migrations.AddField( + model_name='normarelacionada', + name='tipo_vinculo', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='norma.TipoVinculoNormaJuridica', verbose_name='Tipo de Vínculo'), + ), migrations.AddField( model_name='normajuridica', name='tipo', - field=models.ForeignKey(to='norma.TipoNormaJuridica', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='norma.TipoNormaJuridica', verbose_name='Tipo da Norma Juridica'), ), migrations.AddField( model_name='legislacaocitada', name='norma', - field=models.ForeignKey(to='norma.NormaJuridica'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='norma.NormaJuridica'), ), ] diff --git a/sapl/norma/migrations/0002_auto_20150729_1717.py b/sapl/norma/migrations/0002_auto_20150729_1717.py deleted file mode 100644 index d2a9cba0f..000000000 --- a/sapl/norma/migrations/0002_auto_20150729_1717.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(verbose_name='Ano'), - ), - migrations.AlterField( - model_name='normajuridica', - name='numero', - field=models.PositiveIntegerField(verbose_name='Número'), - ), - migrations.AlterField( - model_name='normajuridica', - name='pagina_fim_publicacao', - field=models.PositiveIntegerField(blank=True, verbose_name='Pg. Fim', null=True), - ), - migrations.AlterField( - model_name='normajuridica', - name='pagina_inicio_publicacao', - field=models.PositiveIntegerField(blank=True, verbose_name='Pg. Início', null=True), - ), - ] diff --git a/sapl/norma/migrations/0002_auto_20170403_1505.py b/sapl/norma/migrations/0002_auto_20170403_1505.py new file mode 100644 index 000000000..002aa0e11 --- /dev/null +++ b/sapl/norma/migrations/0002_auto_20170403_1505.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2017-04-03 15:05 +from __future__ import unicode_literals + +from django.db import migrations, models +import sapl.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='normajuridica', + name='texto_integral', + field=models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'), + ), + ] diff --git a/sapl/norma/migrations/0003_auto_20150906_0239.py b/sapl/norma/migrations/0003_auto_20150906_0239.py deleted file mode 100644 index dff90c71e..000000000 --- a/sapl/norma/migrations/0003_auto_20150906_0239.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0002_auto_20150729_1717'), - ] - - operations = [ - migrations.CreateModel( - name='AssuntoNormaRelationship', - fields=[ - ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), - ('assunto', models.ForeignKey(to='norma.AssuntoNorma')), - ], - ), - migrations.RemoveField( - model_name='normajuridica', - name='assunto', - ), - migrations.AddField( - model_name='assuntonormarelationship', - name='norma', - field=models.ForeignKey(to='norma.NormaJuridica'), - ), - migrations.AddField( - model_name='normajuridica', - name='assuntos', - field=models.ManyToManyField(to='norma.AssuntoNorma', through='norma.AssuntoNormaRelationship'), - ), - ] diff --git a/sapl/norma/migrations/0003_auto_20170510_1549.py b/sapl/norma/migrations/0003_auto_20170510_1549.py new file mode 100644 index 000000000..9cbd4962a --- /dev/null +++ b/sapl/norma/migrations/0003_auto_20170510_1549.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2017-05-10 15:49 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0002_auto_20170403_1505'), + ] + + operations = [ + migrations.AlterModelOptions( + name='assuntonorma', + options={'verbose_name': 'Assunto de Norma Jurídica', 'verbose_name_plural': 'Assuntos de Normas Jurídicas'}, + ), + ] diff --git a/sapl/norma/migrations/0004_auto_20150907_0004.py b/sapl/norma/migrations/0004_auto_20150907_0004.py deleted file mode 100644 index 9a716cabc..000000000 --- a/sapl/norma/migrations/0004_auto_20150907_0004.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0003_auto_20150906_0239'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([('assunto', 'norma')]), - ), - ] diff --git a/sapl/norma/migrations/0005_auto_20150915_1141.py b/sapl/norma/migrations/0005_auto_20150915_1141.py deleted file mode 100644 index 6d9798f23..000000000 --- a/sapl/norma/migrations/0005_auto_20150915_1141.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0004_auto_20150907_0004'), - ] - - operations = [ - migrations.AlterModelOptions( - name='normajuridica', - options={'verbose_name_plural': 'Normas Jurídicas', 'verbose_name': 'Norma Jurídica', 'ordering': ['-data']}, - ), - ] diff --git a/sapl/norma/migrations/0006_auto_20151025_1427.py b/sapl/norma/migrations/0006_auto_20151025_1427.py deleted file mode 100644 index 1a5f7c607..000000000 --- a/sapl/norma/migrations/0006_auto_20151025_1427.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0005_auto_20150915_1141'), - ] - - operations = [ - migrations.AlterModelOptions( - name='normajuridica', - options={'ordering': ['-data', '-numero'], 'verbose_name_plural': 'Normas Jurídicas', 'verbose_name': 'Norma Jurídica'}, - ), - ] diff --git a/sapl/norma/migrations/0007_auto_20151130_1632.py b/sapl/norma/migrations/0007_auto_20151130_1632.py deleted file mode 100644 index 745eda239..000000000 --- a/sapl/norma/migrations/0007_auto_20151130_1632.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0006_auto_20151025_1427'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='complemento', - field=models.NullBooleanField(verbose_name='Complementar ?', choices=[(True, 'Sim'), (False, 'Não')]), - ), - ] diff --git a/sapl/norma/migrations/0008_normajuridica_texto_integral.py b/sapl/norma/migrations/0008_normajuridica_texto_integral.py deleted file mode 100644 index 7415852b5..000000000 --- a/sapl/norma/migrations/0008_normajuridica_texto_integral.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import sapl.norma.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0007_auto_20151130_1632'), - ] - - operations = [ - migrations.AddField( - model_name='normajuridica', - name='texto_integral', - field=models.FileField( - null=True, verbose_name='Texto Integral', upload_to=sapl.norma.models.texto_upload_path, blank=True), - ), - ] diff --git a/sapl/norma/migrations/0009_auto_20160106_1511.py b/sapl/norma/migrations/0009_auto_20160106_1511.py deleted file mode 100644 index f7c0766cb..000000000 --- a/sapl/norma/migrations/0009_auto_20160106_1511.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0008_normajuridica_texto_integral'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='tipo', - field=models.ForeignKey(verbose_name='Tipo da Norma Juridica', to='norma.TipoNormaJuridica'), - ), - ] diff --git a/sapl/norma/migrations/0010_auto_20160216_1015.py b/sapl/norma/migrations/0010_auto_20160216_1015.py deleted file mode 100644 index 6aaa8e5d6..000000000 --- a/sapl/norma/migrations/0010_auto_20160216_1015.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0009_auto_20160106_1511'), - ] - - operations = [ - migrations.AlterField( - model_name='assuntonorma', - name='descricao', - field=models.CharField(verbose_name='Descrição', max_length=250, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='alinea', - field=models.CharField(verbose_name='Alínea', max_length=3, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='artigo', - field=models.CharField(verbose_name='Artigo', max_length=4, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='capitulo', - field=models.CharField(verbose_name='Capítulo', max_length=7, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='disposicoes', - field=models.CharField(verbose_name='Disposição', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='inciso', - field=models.CharField(verbose_name='Inciso', max_length=10, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='item', - field=models.CharField(verbose_name='Item', max_length=3, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='livro', - field=models.CharField(verbose_name='Livro', max_length=7, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='paragrafo', - field=models.CharField(verbose_name='Parágrafo', max_length=3, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='parte', - field=models.CharField(verbose_name='Parte', max_length=8, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='secao', - field=models.CharField(verbose_name='Seção', max_length=7, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='subsecao', - field=models.CharField(verbose_name='Subseção', max_length=7, blank=True), - ), - migrations.AlterField( - model_name='legislacaocitada', - name='titulo', - field=models.CharField(verbose_name='Título', max_length=7, blank=True), - ), - migrations.AlterField( - model_name='normajuridica', - name='indexacao', - field=models.TextField(verbose_name='Indexação', blank=True), - ), - migrations.AlterField( - model_name='normajuridica', - name='observacao', - field=models.TextField(verbose_name='Observação', blank=True), - ), - migrations.AlterField( - model_name='normajuridica', - name='veiculo_publicacao', - field=models.CharField(verbose_name='Veículo Publicação', max_length=30, blank=True), - ), - migrations.AlterField( - model_name='tiponormajuridica', - name='equivalente_lexml', - field=models.CharField(blank=True, verbose_name='Equivalente LexML', choices=[('constituicao', 'constituicao'), ('ementa.constitucional', 'ementa.constitucional'), ('lei.complementar', 'lei.complementar'), ('lei.delegada', 'lei.delegada'), ('lei', 'lei'), ('decreto.lei', 'decreto.lei'), ('medida.provisoria', 'medida.provisoria'), ('decreto', 'decreto'), ('lei.organica', 'lei.organica'), ('emenda.lei.organica', 'emenda.lei.organica'), ('decreto.legislativo', 'decreto.legislativo'), ('resolucao', 'resolucao'), ('regimento.interno', 'regimento.interno')], max_length=50), - ), - migrations.AlterField( - model_name='vinculonormajuridica', - name='tipo_vinculo', - field=models.CharField(blank=True, choices=[('A', 'Altera a norma'), ('R', 'Revoga a norma'), ('P', 'Revoga parcialmente a norma'), ('T', 'Revoga por consolidação a norma'), ('C', 'Norma correlata'), ('I', 'Suspende a execução da norma'), ('G', 'Regulamenta a norma')], max_length=1), - ), - ] diff --git a/sapl/norma/migrations/0011_auto_20160307_1153.py b/sapl/norma/migrations/0011_auto_20160307_1153.py deleted file mode 100644 index 19631773d..000000000 --- a/sapl/norma/migrations/0011_auto_20160307_1153.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 14:53 -from __future__ import unicode_literals - -import datetime -from django.db import migrations, models -from django.utils.timezone import utc - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0010_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='data', - field=models.DateField(default=datetime.datetime(2016, 3, 7, 14, 53, 52, 206255, tzinfo=utc), verbose_name='Data'), - preserve_default=False, - ), - ] diff --git a/sapl/norma/migrations/0012_auto_20160309_1407.py b/sapl/norma/migrations/0012_auto_20160309_1407.py deleted file mode 100644 index 7075fa270..000000000 --- a/sapl/norma/migrations/0012_auto_20160309_1407.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-09 17:07 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0011_auto_20160307_1153'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - ] diff --git a/sapl/norma/migrations/0013_auto_20160503_0926.py b/sapl/norma/migrations/0013_auto_20160503_0926.py deleted file mode 100644 index 8c15dae96..000000000 --- a/sapl/norma/migrations/0013_auto_20160503_0926.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-03 12:26 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0012_auto_20160309_1407'), - ] - - operations = [ - migrations.AlterField( - model_name='vinculonormajuridica', - name='norma_referente', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_referente_set', to='norma.NormaJuridica'), - ), - migrations.AlterField( - model_name='vinculonormajuridica', - name='norma_referida', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_referida_set', to='norma.NormaJuridica'), - ), - ] diff --git a/sapl/norma/migrations/0013_auto_20160510_1404.py b/sapl/norma/migrations/0013_auto_20160510_1404.py deleted file mode 100644 index 97d780cb5..000000000 --- a/sapl/norma/migrations/0013_auto_20160510_1404.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 17:04 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0012_auto_20160309_1407'), - ] - - operations = [ - migrations.AlterField( - model_name='vinculonormajuridica', - name='tipo_vinculo', - field=models.CharField(blank=True, choices=[('A', 'Altera a norma'), ('R', 'Revoga integralmente a norma'), ('P', 'Revoga parcialmente a norma'), ('T', 'Revoga integralmente por consolidação'), ('C', 'Norma correlata'), ('S', 'Ressalva a norma'), ('E', 'Reedita a norma'), ('I', 'Reedita a norma com alteração'), ('G', 'Regulamenta a norma'), ('K', 'Suspende parcialmente a norma'), ('L', 'Suspende integralmente a norma'), ('N', 'Julgada integralmente inconstitucional'), ('O', 'Julgada parcialmente inconstitucional')], max_length=1), - ), - ] diff --git a/sapl/norma/migrations/0014_merge.py b/sapl/norma/migrations/0014_merge.py deleted file mode 100644 index be6ffd022..000000000 --- a/sapl/norma/migrations/0014_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-08 16:14 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0013_auto_20160510_1404'), - ('norma', '0013_auto_20160503_0926'), - ] - - operations = [ - ] diff --git a/sapl/norma/migrations/0015_auto_20160929_1635.py b/sapl/norma/migrations/0015_auto_20160929_1635.py deleted file mode 100644 index 5ea7f8a1b..000000000 --- a/sapl/norma/migrations/0015_auto_20160929_1635.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 19:35 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0014_merge'), - ] - - operations = [ - migrations.AlterModelOptions( - name='legislacaocitada', - options={'verbose_name': 'Legislação', 'verbose_name_plural': 'Legislações'}, - ), - ] diff --git a/sapl/norma/migrations/0016_auto_20161027_1419.py b/sapl/norma/migrations/0016_auto_20161027_1419.py deleted file mode 100644 index b090e538a..000000000 --- a/sapl/norma/migrations/0016_auto_20161027_1419.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-27 14:19 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0015_auto_20160929_1635'), - ] - - operations = [ - migrations.AlterModelOptions( - name='assuntonormarelationship', - options={'verbose_name': 'Assunto', 'verbose_name_plural': 'Assuntos'}, - ), - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([]), - ), - ] diff --git a/sapl/norma/migrations/0017_auto_20161027_1432.py b/sapl/norma/migrations/0017_auto_20161027_1432.py deleted file mode 100644 index 93208eb69..000000000 --- a/sapl/norma/migrations/0017_auto_20161027_1432.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-27 14:32 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0016_auto_20161027_1419'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='assuntos', - field=models.ManyToManyField(through='norma.AssuntoNormaRelationship', to='norma.AssuntoNorma', verbose_name='Assuntos'), - ), - ] diff --git a/sapl/norma/migrations/0018_auto_20161027_1434.py b/sapl/norma/migrations/0018_auto_20161027_1434.py deleted file mode 100644 index c70998631..000000000 --- a/sapl/norma/migrations/0018_auto_20161027_1434.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-27 14:34 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0017_auto_20161027_1432'), - ] - - operations = [ - migrations.AlterField( - model_name='assuntonormarelationship', - name='assunto', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='norma.AssuntoNorma', verbose_name='Assunto'), - ), - migrations.AlterField( - model_name='assuntonormarelationship', - name='norma', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='norma.NormaJuridica', verbose_name='Norma'), - ), - ] diff --git a/sapl/norma/migrations/0019_auto_20161028_0232.py b/sapl/norma/migrations/0019_auto_20161028_0232.py deleted file mode 100644 index 075607017..000000000 --- a/sapl/norma/migrations/0019_auto_20161028_0232.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 02:32 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0018_auto_20161027_1434'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([('assunto', 'norma')]), - ), - ] diff --git a/sapl/norma/migrations/0020_auto_20161028_1335.py b/sapl/norma/migrations/0020_auto_20161028_1335.py deleted file mode 100644 index 4391c8340..000000000 --- a/sapl/norma/migrations/0020_auto_20161028_1335.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 13:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0019_auto_20161028_0232'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([]), - ), - migrations.RemoveField( - model_name='assuntonormarelationship', - name='assunto', - ), - migrations.RemoveField( - model_name='assuntonormarelationship', - name='norma', - ), - migrations.RemoveField( - model_name='normajuridica', - name='assuntos', - ), - migrations.AddField( - model_name='normajuridica', - name='assuntos', - field=models.TextField(blank=True, null=True), - ), - migrations.DeleteModel( - name='AssuntoNormaRelationship', - ), - ] diff --git a/sapl/norma/migrations/0021_auto_20161028_1335.py b/sapl/norma/migrations/0021_auto_20161028_1335.py deleted file mode 100644 index bbadc60d2..000000000 --- a/sapl/norma/migrations/0021_auto_20161028_1335.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 13:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0020_auto_20161028_1335'), - ] - - operations = [ - migrations.RemoveField( - model_name='normajuridica', - name='assuntos', - ), - migrations.AddField( - model_name='normajuridica', - name='assuntos', - field=models.ManyToManyField(blank=True, to='norma.AssuntoNorma', verbose_name='Assuntos'), - ), - ] diff --git a/sapl/norma/migrations/0022_auto_20161110_0910.py b/sapl/norma/migrations/0022_auto_20161110_0910.py deleted file mode 100644 index c440abb8a..000000000 --- a/sapl/norma/migrations/0022_auto_20161110_0910.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-10 09:10 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0021_auto_20161028_1335'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - ] diff --git a/sapl/norma/migrations/0023_auto_20161123_1359.py b/sapl/norma/migrations/0023_auto_20161123_1359.py deleted file mode 100644 index 450071cc8..000000000 --- a/sapl/norma/migrations/0023_auto_20161123_1359.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-23 13:59 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0022_auto_20161110_0910'), - ] - - operations = [ - migrations.AlterModelOptions( - name='vinculonormajuridica', - options={'verbose_name': 'Tipo de Vínculo entre Normas Jurídicas', 'verbose_name_plural': 'Tipos de Vínculos entre Normas Jurídicas'}, - ), - migrations.RemoveField( - model_name='vinculonormajuridica', - name='norma_referente', - ), - migrations.RemoveField( - model_name='vinculonormajuridica', - name='norma_referida', - ), - migrations.RemoveField( - model_name='vinculonormajuridica', - name='tipo_vinculo', - ), - migrations.AddField( - model_name='vinculonormajuridica', - name='descricao', - field=models.CharField(blank=True, max_length=20, verbose_name='Descrição'), - ), - migrations.AddField( - model_name='vinculonormajuridica', - name='sigla', - field=models.CharField(blank=True, max_length=1, verbose_name='Nome'), - ), - ] diff --git a/sapl/norma/migrations/0024_auto_20161123_1430.py b/sapl/norma/migrations/0024_auto_20161123_1430.py deleted file mode 100644 index e531c2a38..000000000 --- a/sapl/norma/migrations/0024_auto_20161123_1430.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-23 14:30 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0023_auto_20161123_1359'), - ] - - operations = [ - migrations.AlterField( - model_name='vinculonormajuridica', - name='descricao', - field=models.CharField(blank=True, max_length=50, verbose_name='Descrição'), - ), - migrations.AlterField( - model_name='vinculonormajuridica', - name='sigla', - field=models.CharField(blank=True, max_length=1, verbose_name='Sigla'), - ), - ] diff --git a/sapl/norma/migrations/0025_normarelacionada.py b/sapl/norma/migrations/0025_normarelacionada.py deleted file mode 100644 index 1cfafedb2..000000000 --- a/sapl/norma/migrations/0025_normarelacionada.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-23 14:44 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0024_auto_20161123_1430'), - ] - - operations = [ - migrations.CreateModel( - name='NormaRelacionada', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('norma_principal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_principal', to='norma.NormaJuridica')), - ('norma_relacionada', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_relacionada', to='norma.NormaJuridica')), - ('tipo_vinculo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='norma.VinculoNormaJuridica')), - ], - options={ - 'verbose_name': 'Norma Relacionada', - 'verbose_name_plural': 'Normas Relacionadas', - }, - ), - ] diff --git a/sapl/norma/migrations/0026_auto_20161123_1450.py b/sapl/norma/migrations/0026_auto_20161123_1450.py deleted file mode 100644 index 6fda19247..000000000 --- a/sapl/norma/migrations/0026_auto_20161123_1450.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-23 14:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0025_normarelacionada'), - ] - - operations = [ - migrations.AlterField( - model_name='normarelacionada', - name='tipo_vinculo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='norma.VinculoNormaJuridica', verbose_name='Tipo de Vínculo'), - ), - ] diff --git a/sapl/norma/migrations/0027_auto_20161123_1538.py b/sapl/norma/migrations/0027_auto_20161123_1538.py deleted file mode 100644 index f44348b0e..000000000 --- a/sapl/norma/migrations/0027_auto_20161123_1538.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-23 15:38 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0026_auto_20161123_1450'), - ] - - operations = [ - migrations.AlterField( - model_name='normarelacionada', - name='norma_principal', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_principal', to='norma.NormaJuridica', verbose_name='Norma Principal'), - ), - migrations.AlterField( - model_name='normarelacionada', - name='norma_relacionada', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='norma_relacionada', to='norma.NormaJuridica', verbose_name='Norma Relacionada'), - ), - ] diff --git a/sapl/norma/migrations/0028_auto_20161202_1025.py b/sapl/norma/migrations/0028_auto_20161202_1025.py deleted file mode 100644 index 2bfebb011..000000000 --- a/sapl/norma/migrations/0028_auto_20161202_1025.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-02 10:25 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0027_auto_20161123_1538'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='materia', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa', verbose_name='Matéria'), - ), - ] diff --git a/sapl/norma/migrations/0029_auto_20161215_1652.py b/sapl/norma/migrations/0029_auto_20161215_1652.py deleted file mode 100644 index 9ef00a353..000000000 --- a/sapl/norma/migrations/0029_auto_20161215_1652.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-15 16:52 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0028_auto_20161202_1025'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tiponormajuridica', - options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Norma Jurídica', 'verbose_name_plural': 'Tipos de Norma Jurídica'}, - ), - ] diff --git a/sapl/norma/migrations/0029_auto_20161216_1640.py b/sapl/norma/migrations/0029_auto_20161216_1640.py deleted file mode 100644 index cfb965cc9..000000000 --- a/sapl/norma/migrations/0029_auto_20161216_1640.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2016-12-16 16:40 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0028_auto_20161202_1025'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tiponormajuridica', - options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Norma Jurídica', 'verbose_name_plural': 'Tipos de Norma Jurídica'}, - ), - ] diff --git a/sapl/norma/migrations/0030_auto_20170102_0951.py b/sapl/norma/migrations/0030_auto_20170102_0951.py deleted file mode 100644 index ac8d9c443..000000000 --- a/sapl/norma/migrations/0030_auto_20170102_0951.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-02 09:51 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0029_auto_20161216_1640'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - ] diff --git a/sapl/norma/migrations/0030_merge.py b/sapl/norma/migrations/0030_merge.py deleted file mode 100644 index beb05625c..000000000 --- a/sapl/norma/migrations/0030_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-19 13:06 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0029_auto_20161216_1640'), - ('norma', '0029_auto_20161215_1652'), - ] - - operations = [ - ] diff --git a/sapl/norma/migrations/0031_auto_20161219_1324.py b/sapl/norma/migrations/0031_auto_20161219_1324.py deleted file mode 100644 index 27d77c035..000000000 --- a/sapl/norma/migrations/0031_auto_20161219_1324.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-19 13:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0030_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='numero', - field=models.CharField(max_length=8, verbose_name='Número'), - ), - ] diff --git a/sapl/norma/migrations/0032_merge.py b/sapl/norma/migrations/0032_merge.py deleted file mode 100644 index ec812bf6c..000000000 --- a/sapl/norma/migrations/0032_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-01-10 15:32 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0031_auto_20161219_1324'), - ('norma', '0030_auto_20170102_0951'), - ] - - operations = [ - ] diff --git a/sapl/norma/migrations/0033_auto_20170123_1548.py b/sapl/norma/migrations/0033_auto_20170123_1548.py deleted file mode 100644 index 918c476c9..000000000 --- a/sapl/norma/migrations/0033_auto_20170123_1548.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-23 15:48 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0032_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - ] diff --git a/sapl/norma/migrations/0033_auto_20170203_1019.py b/sapl/norma/migrations/0033_auto_20170203_1019.py deleted file mode 100644 index 22157ad6f..000000000 --- a/sapl/norma/migrations/0033_auto_20170203_1019.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-03 10:19 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0032_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='normajuridica', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - ] diff --git a/sapl/norma/migrations/0034_auto_20170222_1435.py b/sapl/norma/migrations/0034_auto_20170222_1435.py deleted file mode 100644 index 1fbb85152..000000000 --- a/sapl/norma/migrations/0034_auto_20170222_1435.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-22 14:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0033_auto_20170203_1019'), - ] - - operations = [ - migrations.RemoveField( - model_name='vinculonormajuridica', - name='descricao', - ), - migrations.AddField( - model_name='vinculonormajuridica', - name='descricao_ativa', - field=models.CharField(blank=True, max_length=50, verbose_name='Descrição Ativa'), - ), - migrations.AddField( - model_name='vinculonormajuridica', - name='descricao_passiva', - field=models.CharField(blank=True, max_length=50, verbose_name='Descrição Passiva'), - ), - ] diff --git a/sapl/norma/migrations/0035_auto_20170222_1438.py b/sapl/norma/migrations/0035_auto_20170222_1438.py deleted file mode 100644 index e8b1c0ddc..000000000 --- a/sapl/norma/migrations/0035_auto_20170222_1438.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-22 14:38 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0034_auto_20170222_1435'), - ] - - operations = [ - migrations.RenameModel( - old_name='VinculoNormaJuridica', - new_name='TipoVinculoNormaJuridica', - ), - ] diff --git a/sapl/norma/migrations/0036_merge.py b/sapl/norma/migrations/0036_merge.py deleted file mode 100644 index 207c3b3c0..000000000 --- a/sapl/norma/migrations/0036_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-03 16:34 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0035_auto_20170222_1438'), - ('norma', '0033_auto_20170123_1548'), - ] - - operations = [ - ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index 8a412be1c..0d0b8ce6b 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -7,7 +7,8 @@ from model_utils import Choices from sapl.compilacao.models import TextoArticulado from sapl.materia.models import MateriaLegislativa -from sapl.utils import RANGE_ANOS, YES_NO_CHOICES, texto_upload_path +from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, + restringe_tipos_de_arquivo_txt, texto_upload_path) @reversion.register() @@ -17,8 +18,8 @@ class AssuntoNorma(models.Model): max_length=250, blank=True, verbose_name=_('Descrição')) class Meta: - verbose_name = _('Assunto de Norma') - verbose_name_plural = _('Assuntos de Norma') + verbose_name = _('Assunto de Norma Jurídica') + verbose_name_plural = _('Assuntos de Normas Jurídicas') def __str__(self): return self.assunto @@ -70,11 +71,15 @@ class NormaJuridica(models.Model): blank=True, null=True, upload_to=texto_upload_path, - verbose_name=_('Texto Integral')) + verbose_name=_('Texto Integral'), + validators=[restringe_tipos_de_arquivo_txt]) tipo = models.ForeignKey( - TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica')) + TipoNormaJuridica, + on_delete=models.PROTECT, + verbose_name=_('Tipo da Norma Juridica')) materia = models.ForeignKey( - MateriaLegislativa, blank=True, null=True, verbose_name=_('Matéria')) + MateriaLegislativa, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Matéria')) numero = models.CharField( max_length=8, verbose_name=_('Número')) @@ -158,8 +163,8 @@ class NormaJuridica(models.Model): @reversion.register() class LegislacaoCitada(models.Model): - materia = models.ForeignKey(MateriaLegislativa) - norma = models.ForeignKey(NormaJuridica) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) + norma = models.ForeignKey(NormaJuridica, on_delete=models.PROTECT) disposicoes = models.CharField( max_length=15, blank=True, verbose_name=_('Disposição')) parte = models.CharField( @@ -215,13 +220,17 @@ class NormaRelacionada(models.Model): norma_principal = models.ForeignKey( NormaJuridica, related_name='norma_principal', + on_delete=models.PROTECT, verbose_name=_('Norma Principal')) norma_relacionada = models.ForeignKey( NormaJuridica, related_name='norma_relacionada', + on_delete=models.PROTECT, verbose_name=_('Norma Relacionada')) tipo_vinculo = models.ForeignKey( - TipoVinculoNormaJuridica, verbose_name=_('Tipo de Vínculo')) + TipoVinculoNormaJuridica, + on_delete=models.PROTECT, + verbose_name=_('Tipo de Vínculo')) class Meta: verbose_name = _('Norma Relacionada') diff --git a/sapl/norma/signals.py b/sapl/norma/signals.py new file mode 100644 index 000000000..3089e563e --- /dev/null +++ b/sapl/norma/signals.py @@ -0,0 +1,8 @@ +from django.db.models.signals import post_delete, post_save +from sapl.utils import save_texto, delete_texto + +from .models import NormaJuridica + + +post_save.connect(save_texto, sender=NormaJuridica) +post_delete.connect(delete_texto, sender=NormaJuridica) diff --git a/sapl/norma/urls.py b/sapl/norma/urls.py index 4d434d42b..abf13c276 100644 --- a/sapl/norma/urls.py +++ b/sapl/norma/urls.py @@ -24,6 +24,6 @@ urlpatterns = [ url(r'^norma/pesquisar$', NormaPesquisaView.as_view(), name='norma_pesquisa'), - url(r'^norma/recuperar-norma/', recuperar_norma), + url(r'^norma/recuperar-norma$', recuperar_norma, name="recuperar_norma"), ] diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 10dbf4ad2..9120da4e9 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -1,10 +1,7 @@ -from datetime import datetime - +from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.http import JsonResponse -from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ -from django.views.generic import FormView, ListView from django.views.generic.base import RedirectView from django_filters.views import FilterView diff --git a/sapl/painel/migrations/0001_initial.py b/sapl/painel/migrations/0001_initial.py index 3b2dfa3c1..5bf809cf7 100644 --- a/sapl/painel/migrations/0001_initial.py +++ b/sapl/painel/migrations/0001_initial.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models @@ -6,6 +7,8 @@ from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ ] @@ -13,19 +16,19 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Cronometro', fields=[ - ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), - ('status', models.CharField(max_length=1, verbose_name='Status do cronômetro', choices=[('I', 'Start'), ('R', 'Reset'), ('S', 'Stop')], default='S')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(choices=[('I', 'Start'), ('R', 'Reset'), ('S', 'Stop')], default='S', max_length=1, verbose_name='Status do cronômetro')), ('data_cronometro', models.DateField(verbose_name='Data do cronômetro')), - ('tipo', models.CharField(max_length=1, verbose_name='Tipo Cronômetro', choices=[('A', 'Aparte'), ('D', 'Discurso'), ('O', 'Ordem do dia')])), + ('tipo', models.CharField(choices=[('A', 'Aparte'), ('D', 'Discurso'), ('O', 'Ordem do dia')], max_length=1, verbose_name='Tipo Cronômetro')), ], ), migrations.CreateModel( name='Painel', fields=[ - ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('aberto', models.BooleanField(default=False, verbose_name='Abrir painel')), ('data_painel', models.DateField(verbose_name='Data painel')), - ('mostrar', models.CharField(max_length=1, choices=[('C', 'Completo'), ('P', 'Parlamentares'), ('V', 'Votação'), ('M', 'Mensagem')], default='C')), + ('mostrar', models.CharField(choices=[('C', 'Completo'), ('P', 'Parlamentares'), ('V', 'Votação'), ('M', 'Mensagem')], default='C', max_length=1)), ], ), ] diff --git a/sapl/parlamentares/forms.py b/sapl/parlamentares/forms.py index cd70ca995..9e2b26b59 100644 --- a/sapl/parlamentares/forms.py +++ b/sapl/parlamentares/forms.py @@ -62,7 +62,7 @@ class MandatoForm(ModelForm): data = self.cleaned_data try: if 'legislatura' in data and 'parlamentar' in data: - mandato = Mandato.objects.get( + Mandato.objects.get( parlamentar__pk=self.initial['parlamentar'].pk, legislatura__pk=data['legislatura'].pk) except ObjectDoesNotExist: diff --git a/sapl/parlamentares/migrations/0001_initial.py b/sapl/parlamentares/migrations/0001_initial.py index 152a92f82..4d9d88bbe 100644 --- a/sapl/parlamentares/migrations/0001_initial.py +++ b/sapl/parlamentares/migrations/0001_initial.py @@ -1,297 +1,343 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals +from django.conf import settings from django.db import migrations, models +import django.db.models.deletion +import sapl.parlamentares.models +import sapl.utils class Migration(migrations.Migration): + initial = True + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='CargoMesa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Cargo na Mesa')), - ('unico', models.BooleanField(verbose_name='Cargo Único', choices=[(True, 'Sim'), (False, 'Não')])), + ('unico', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Cargo Único')), ], options={ - 'verbose_name_plural': 'Cargos na Mesa', 'verbose_name': 'Cargo na Mesa', + 'verbose_name_plural': 'Cargos na Mesa', }, ), migrations.CreateModel( name='Coligacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), - ('numero_votos', models.IntegerField(blank=True, null=True, verbose_name='Nº Votos Recebidos')), + ('numero_votos', models.PositiveIntegerField(blank=True, null=True, verbose_name='Nº Votos Recebidos')), ], options={ - 'verbose_name_plural': 'Coligações', 'verbose_name': 'Coligação', + 'verbose_name_plural': 'Coligações', }, ), migrations.CreateModel( name='ComposicaoColigacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('coligacao', models.ForeignKey(to='parlamentares.Coligacao')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('coligacao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Coligacao')), ], options={ - 'verbose_name_plural': 'Composição Coligações', 'verbose_name': 'Composição Coligação', + 'verbose_name_plural': 'Composição Coligações', }, ), migrations.CreateModel( name='ComposicaoMesa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('cargo', models.ForeignKey(to='parlamentares.CargoMesa')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cargo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.CargoMesa')), ], options={ - 'verbose_name_plural': 'Ocupações de cargo na Mesa', 'verbose_name': 'Ocupação de cargo na Mesa', + 'verbose_name_plural': 'Ocupações de cargo na Mesa', }, ), migrations.CreateModel( name='Dependente', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('sexo', models.CharField(choices=[('F', 'Feminino'), ('M', 'Masculino')], max_length=1, verbose_name='Sexo')), ('data_nascimento', models.DateField(blank=True, null=True, verbose_name='Data Nascimento')), - ('cpf', models.CharField(blank=True, max_length=14, null=True, verbose_name='CPF')), - ('rg', models.CharField(blank=True, max_length=15, null=True, verbose_name='RG')), - ('titulo_eleitor', models.CharField(blank=True, max_length=15, null=True, verbose_name='Nº Título Eleitor')), + ('cpf', models.CharField(blank=True, max_length=14, verbose_name='CPF')), + ('rg', models.CharField(blank=True, max_length=15, verbose_name='RG')), + ('titulo_eleitor', models.CharField(blank=True, max_length=15, verbose_name='Nº Título Eleitor')), ], options={ - 'verbose_name_plural': 'Dependentes', 'verbose_name': 'Dependente', + 'verbose_name_plural': 'Dependentes', }, ), migrations.CreateModel( name='Filiacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data', models.DateField(verbose_name='Data Filiação')), ('data_desfiliacao', models.DateField(blank=True, null=True, verbose_name='Data Desfiliação')), ], options={ - 'verbose_name_plural': 'Filiações', + 'ordering': ('parlamentar', '-data', '-data_desfiliacao'), 'verbose_name': 'Filiação', + 'verbose_name_plural': 'Filiações', + }, + ), + migrations.CreateModel( + name='Frente', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(max_length=80, verbose_name='Nome da Frente')), + ('data_criacao', models.DateField(verbose_name='Data Criação')), + ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data Dissolução')), + ('descricao', models.TextField(blank=True, verbose_name='Descrição')), + ], + options={ + 'verbose_name': 'Frente', + 'verbose_name_plural': 'Frentes', }, ), migrations.CreateModel( name='Legislatura', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero', models.PositiveIntegerField(verbose_name='Número')), ('data_inicio', models.DateField(verbose_name='Data Início')), ('data_fim', models.DateField(verbose_name='Data Fim')), ('data_eleicao', models.DateField(verbose_name='Data Eleição')), ], options={ - 'verbose_name_plural': 'Legislaturas', + 'ordering': ['-data_inicio'], 'verbose_name': 'Legislatura', + 'verbose_name_plural': 'Legislaturas', }, ), migrations.CreateModel( name='Mandato', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('tipo_causa_fim_mandato', models.IntegerField(blank=True, null=True)), - ('data_fim_mandato', models.DateField(blank=True, null=True, verbose_name='Fim do Mandato')), - ('votos_recebidos', models.IntegerField(blank=True, null=True, verbose_name='Votos Recebidos')), - ('data_expedicao_diploma', models.DateField(blank=True, null=True, verbose_name='Expedição do Diploma')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Observação')), - ('coligacao', models.ForeignKey(blank=True, null=True, to='parlamentares.Coligacao', verbose_name='Coligação')), - ('legislatura', models.ForeignKey(to='parlamentares.Legislatura', verbose_name='Legislatura')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('tipo_causa_fim_mandato', models.PositiveIntegerField(blank=True, null=True)), + ('data_fim_mandato', models.DateField(verbose_name='Fim do Mandato')), + ('votos_recebidos', models.PositiveIntegerField(blank=True, null=True, verbose_name='Votos Recebidos')), + ('data_expedicao_diploma', models.DateField(verbose_name='Expedição do Diploma')), + ('titular', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], db_index=True, default=True, verbose_name='Vereador Titular')), + ('observacao', models.TextField(blank=True, verbose_name='Observação')), + ('coligacao', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Coligacao', verbose_name='Coligação')), + ('legislatura', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Legislatura', verbose_name='Legislatura')), ], options={ - 'verbose_name_plural': 'Mandatos', 'verbose_name': 'Mandato', + 'verbose_name_plural': 'Mandatos', }, ), migrations.CreateModel( name='Municipio', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('nome', models.CharField(blank=True, max_length=50, null=True)), - ('uf', models.CharField(blank=True, max_length=2, null=True, choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')])), - ('regiao', models.CharField(blank=True, max_length=2, null=True, choices=[('CO', 'Centro-Oeste'), ('NE', 'Nordeste'), ('NO', 'Norte'), ('SE', 'Sudeste'), ('SL', 'Sul'), ('EX', 'Exterior')])), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(blank=True, max_length=50)), + ('uf', models.CharField(blank=True, choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=2)), + ('regiao', models.CharField(blank=True, choices=[('CO', 'Centro-Oeste'), ('NE', 'Nordeste'), ('NO', 'Norte'), ('SE', 'Sudeste'), ('SL', 'Sul'), ('EX', 'Exterior')], max_length=2)), ], options={ - 'verbose_name_plural': 'Municípios', 'verbose_name': 'Município', + 'verbose_name_plural': 'Municípios', }, ), migrations.CreateModel( name='NivelInstrucao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Nível de Instrução')), ], options={ - 'verbose_name_plural': 'Níveis Instrução', 'verbose_name': 'Nível Instrução', + 'verbose_name_plural': 'Níveis Instrução', }, ), migrations.CreateModel( name='Parlamentar', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome_completo', models.CharField(max_length=50, verbose_name='Nome Completo')), - ('nome_parlamentar', models.CharField(blank=True, max_length=50, null=True, verbose_name='Nome Parlamentar')), + ('nome_parlamentar', models.CharField(max_length=50, verbose_name='Nome Parlamentar')), ('sexo', models.CharField(choices=[('F', 'Feminino'), ('M', 'Masculino')], max_length=1, verbose_name='Sexo')), ('data_nascimento', models.DateField(blank=True, null=True, verbose_name='Data Nascimento')), - ('cpf', models.CharField(blank=True, max_length=14, null=True, verbose_name='C.P.F')), - ('rg', models.CharField(blank=True, max_length=15, null=True, verbose_name='R.G.')), - ('titulo_eleitor', models.CharField(blank=True, max_length=15, null=True, verbose_name='Título de Eleitor')), - ('cod_casa', models.IntegerField()), - ('numero_gab_parlamentar', models.CharField(blank=True, max_length=10, null=True, verbose_name='Nº Gabinete')), - ('telefone', models.CharField(blank=True, max_length=50, null=True, verbose_name='Telefone')), - ('fax', models.CharField(blank=True, max_length=50, null=True, verbose_name='Fax')), - ('endereco_residencia', models.CharField(blank=True, max_length=100, null=True, verbose_name='Endereço Residencial')), - ('cep_residencia', models.CharField(blank=True, max_length=9, null=True, verbose_name='CEP')), - ('telefone_residencia', models.CharField(blank=True, max_length=50, null=True, verbose_name='Telefone Residencial')), - ('fax_residencia', models.CharField(blank=True, max_length=50, null=True, verbose_name='Fax Residencial')), - ('endereco_web', models.CharField(blank=True, max_length=100, null=True, verbose_name='HomePage')), - ('profissao', models.CharField(blank=True, max_length=50, null=True, verbose_name='Profissão')), - ('email', models.CharField(blank=True, max_length=100, null=True, verbose_name='Correio Eletrônico')), - ('locais_atuacao', models.CharField(blank=True, max_length=100, null=True, verbose_name='Locais de Atuação')), - ('ativo', models.BooleanField(verbose_name='Ativo na Casa?')), - ('biografia', models.TextField(blank=True, null=True, verbose_name='Biografia')), - ('unidade_deliberativa', models.BooleanField()), - ('municipio_residencia', models.ForeignKey(blank=True, null=True, to='parlamentares.Municipio', verbose_name='Município')), - ('nivel_instrucao', models.ForeignKey(blank=True, null=True, to='parlamentares.NivelInstrucao', verbose_name='Nível Instrução')), + ('cpf', models.CharField(blank=True, max_length=14, verbose_name='C.P.F')), + ('rg', models.CharField(blank=True, max_length=15, verbose_name='R.G.')), + ('titulo_eleitor', models.CharField(blank=True, max_length=15, verbose_name='Título de Eleitor')), + ('numero_gab_parlamentar', models.CharField(blank=True, max_length=10, verbose_name='Nº Gabinete')), + ('telefone', models.CharField(blank=True, max_length=50, verbose_name='Telefone')), + ('fax', models.CharField(blank=True, max_length=50, verbose_name='Fax')), + ('endereco_residencia', models.CharField(blank=True, max_length=100, verbose_name='Endereço Residencial')), + ('cep_residencia', models.CharField(blank=True, max_length=9, verbose_name='CEP')), + ('telefone_residencia', models.CharField(blank=True, max_length=50, verbose_name='Telefone Residencial')), + ('fax_residencia', models.CharField(blank=True, max_length=50, verbose_name='Fax Residencial')), + ('endereco_web', models.URLField(blank=True, max_length=100, verbose_name='HomePage')), + ('profissao', models.CharField(blank=True, max_length=50, verbose_name='Profissão')), + ('email', models.EmailField(blank=True, max_length=100, verbose_name='E-mail')), + ('locais_atuacao', models.CharField(blank=True, max_length=100, verbose_name='Locais de Atuação')), + ('ativo', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], db_index=True, default=False, verbose_name='Ativo na Casa?')), + ('biografia', models.TextField(blank=True, verbose_name='Biografia')), + ('fotografia', models.ImageField(blank=True, null=True, upload_to=sapl.parlamentares.models.foto_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Fotografia')), + ('municipio_residencia', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Municipio', verbose_name='Município')), + ('nivel_instrucao', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.NivelInstrucao', verbose_name='Nível Instrução')), ], options={ - 'verbose_name_plural': 'Parlamentares', + 'ordering': ['nome_parlamentar'], 'verbose_name': 'Parlamentar', + 'verbose_name_plural': 'Parlamentares', }, ), migrations.CreateModel( name='Partido', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('sigla', models.CharField(max_length=9, verbose_name='Sigla')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('data_criacao', models.DateField(blank=True, null=True, verbose_name='Data Criação')), ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data Extinção')), + ('logo_partido', models.ImageField(blank=True, null=True, upload_to=sapl.parlamentares.models.logo_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Logo Partido')), ], options={ - 'verbose_name_plural': 'Partidos', 'verbose_name': 'Partido', + 'verbose_name_plural': 'Partidos', }, ), migrations.CreateModel( name='SessaoLegislativa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero', models.IntegerField(verbose_name='Número')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero', models.PositiveIntegerField(verbose_name='Número')), ('tipo', models.CharField(choices=[('O', 'Ordinária'), ('E', 'Extraordinária')], max_length=1, verbose_name='Tipo')), ('data_inicio', models.DateField(verbose_name='Data Início')), ('data_fim', models.DateField(verbose_name='Data Fim')), ('data_inicio_intervalo', models.DateField(blank=True, null=True, verbose_name='Início Intervalo')), ('data_fim_intervalo', models.DateField(blank=True, null=True, verbose_name='Fim Intervalo')), - ('legislatura', models.ForeignKey(to='parlamentares.Legislatura')), + ('legislatura', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Legislatura', verbose_name='Legislatura')), ], options={ - 'verbose_name_plural': 'Sessões Legislativas', + 'ordering': ['-data_inicio', '-data_fim'], 'verbose_name': 'Sessão Legislativa', + 'verbose_name_plural': 'Sessões Legislativas', }, ), migrations.CreateModel( name='SituacaoMilitar', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Situação Militar')), ], options={ - 'verbose_name_plural': 'Tipos Situações Militares', 'verbose_name': 'Tipo Situação Militar', + 'verbose_name_plural': 'Tipos Situações Militares', }, ), migrations.CreateModel( name='TipoAfastamento', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ('afastamento', models.BooleanField(verbose_name='Indicador')), - ('fim_mandato', models.BooleanField(verbose_name='Indicador')), - ('dispositivo', models.CharField(blank=True, max_length=50, null=True, verbose_name='Dispositivo')), + ('indicador', models.CharField(choices=[('A', 'Afastamento'), ('F', 'Fim de Mandato')], default='F', max_length=1, verbose_name='Indicador')), + ('dispositivo', models.CharField(blank=True, max_length=50, verbose_name='Dispositivo')), ], options={ - 'verbose_name_plural': 'Tipos de Afastamento', 'verbose_name': 'Tipo de Afastamento', + 'verbose_name_plural': 'Tipos de Afastamento', }, ), migrations.CreateModel( name='TipoDependente', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('descricao', models.CharField(max_length=50)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), ], options={ - 'verbose_name_plural': 'Tipos de Dependente', 'verbose_name': 'Tipo de Dependente', + 'verbose_name_plural': 'Tipos de Dependente', + }, + ), + migrations.CreateModel( + name='Votante', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('data', models.DateTimeField(auto_now_add=True, max_length=30, null=True, verbose_name='Data')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='parlamentar', to='parlamentares.Parlamentar', verbose_name='Parlamentar')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='User')), + ], + options={ + 'permissions': (('can_vote', 'Can Vote'),), + 'verbose_name': 'Usuário', + 'verbose_name_plural': 'Usuários', }, ), migrations.AddField( model_name='parlamentar', name='situacao_militar', - field=models.ForeignKey(blank=True, null=True, to='parlamentares.SituacaoMilitar', verbose_name='Situação Militar'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.SituacaoMilitar', verbose_name='Situação Militar'), ), migrations.AddField( model_name='mandato', name='parlamentar', - field=models.ForeignKey(to='parlamentares.Parlamentar'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar'), ), migrations.AddField( model_name='mandato', name='tipo_afastamento', - field=models.ForeignKey(blank=True, null=True, to='parlamentares.TipoAfastamento'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.TipoAfastamento'), + ), + migrations.AddField( + model_name='frente', + name='parlamentares', + field=models.ManyToManyField(blank=True, to='parlamentares.Parlamentar', verbose_name='Parlamentares'), ), migrations.AddField( model_name='filiacao', name='parlamentar', - field=models.ForeignKey(to='parlamentares.Parlamentar'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar'), ), migrations.AddField( model_name='filiacao', name='partido', - field=models.ForeignKey(to='parlamentares.Partido', verbose_name='Partido'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Partido', verbose_name='Partido'), ), migrations.AddField( model_name='dependente', name='parlamentar', - field=models.ForeignKey(to='parlamentares.Parlamentar'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar'), ), migrations.AddField( model_name='dependente', name='tipo', - field=models.ForeignKey(to='parlamentares.TipoDependente', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.TipoDependente', verbose_name='Tipo'), ), migrations.AddField( model_name='composicaomesa', name='parlamentar', - field=models.ForeignKey(to='parlamentares.Parlamentar'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar'), ), migrations.AddField( model_name='composicaomesa', name='sessao_legislativa', - field=models.ForeignKey(to='parlamentares.SessaoLegislativa'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.SessaoLegislativa'), ), migrations.AddField( model_name='composicaocoligacao', name='partido', - field=models.ForeignKey(to='parlamentares.Partido'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Partido', verbose_name='Partidos da Coligação'), ), migrations.AddField( model_name='coligacao', name='legislatura', - field=models.ForeignKey(to='parlamentares.Legislatura', verbose_name='Legislatura'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Legislatura', verbose_name='Legislatura'), ), ] diff --git a/sapl/parlamentares/migrations/0002_auto_20150729_1310.py b/sapl/parlamentares/migrations/0002_auto_20150729_1310.py deleted file mode 100644 index 102db958e..000000000 --- a/sapl/parlamentares/migrations/0002_auto_20150729_1310.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='tipoafastamento', - name='afastamento', - field=models.BooleanField(verbose_name='Indicador', choices=[(True, 'Sim'), (False, 'Não')]), - ), - ] diff --git a/sapl/parlamentares/migrations/0002_auto_20170504_1751.py b/sapl/parlamentares/migrations/0002_auto_20170504_1751.py new file mode 100644 index 000000000..7e7039e94 --- /dev/null +++ b/sapl/parlamentares/migrations/0002_auto_20170504_1751.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2017-05-04 17:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('parlamentares', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='coligacao', + name='numero_votos', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Nº Votos Recebidos (Coligação)'), + ), + migrations.AlterField( + model_name='mandato', + name='votos_recebidos', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Votos Recebidos (Mandato)'), + ), + ] diff --git a/sapl/parlamentares/migrations/0003_auto_20150729_1717.py b/sapl/parlamentares/migrations/0003_auto_20150729_1717.py deleted file mode 100644 index 946e5bb4c..000000000 --- a/sapl/parlamentares/migrations/0003_auto_20150729_1717.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0002_auto_20150729_1310'), - ] - - operations = [ - migrations.AlterField( - model_name='coligacao', - name='numero_votos', - field=models.PositiveIntegerField(blank=True, verbose_name='Nº Votos Recebidos', null=True), - ), - migrations.AlterField( - model_name='mandato', - name='tipo_causa_fim_mandato', - field=models.PositiveIntegerField(blank=True, null=True), - ), - migrations.AlterField( - model_name='mandato', - name='votos_recebidos', - field=models.PositiveIntegerField(blank=True, verbose_name='Votos Recebidos', null=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='cod_casa', - field=models.PositiveIntegerField(), - ), - migrations.AlterField( - model_name='sessaolegislativa', - name='numero', - field=models.PositiveIntegerField(verbose_name='Número'), - ), - ] diff --git a/sapl/parlamentares/migrations/0004_auto_20150929_1425.py b/sapl/parlamentares/migrations/0004_auto_20150929_1425.py deleted file mode 100644 index ffb8ca672..000000000 --- a/sapl/parlamentares/migrations/0004_auto_20150929_1425.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0003_auto_20150729_1717'), - ] - - operations = [ - migrations.AlterModelOptions( - name='parlamentar', - options={'ordering': ['nome_parlamentar'], 'verbose_name': 'Parlamentar', 'verbose_name_plural': 'Parlamentares'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0005_parlamentar_fotografia.py b/sapl/parlamentares/migrations/0005_parlamentar_fotografia.py deleted file mode 100644 index c7aff3aa3..000000000 --- a/sapl/parlamentares/migrations/0005_parlamentar_fotografia.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - -import sapl.parlamentares.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0004_auto_20150929_1425'), - ] - - operations = [ - migrations.AddField( - model_name='parlamentar', - name='fotografia', - field=models.FileField( - blank=True, null=True, verbose_name='Fotografia', upload_to=sapl.parlamentares.models.foto_upload_path), - ), - ] diff --git a/sapl/parlamentares/migrations/0006_auto_20151119_1318.py b/sapl/parlamentares/migrations/0006_auto_20151119_1318.py deleted file mode 100644 index 443dbcced..000000000 --- a/sapl/parlamentares/migrations/0006_auto_20151119_1318.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0005_parlamentar_fotografia'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='unidade_deliberativa', - field=models.BooleanField(verbose_name='Unidade'), - ), - ] diff --git a/sapl/parlamentares/migrations/0007_auto_20151123_1258.py b/sapl/parlamentares/migrations/0007_auto_20151123_1258.py deleted file mode 100644 index e26a752ff..000000000 --- a/sapl/parlamentares/migrations/0007_auto_20151123_1258.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0006_auto_20151119_1318'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='unidade_deliberativa', - field=models.BooleanField(), - ), - ] diff --git a/sapl/parlamentares/migrations/0008_auto_20151126_1332.py b/sapl/parlamentares/migrations/0008_auto_20151126_1332.py deleted file mode 100644 index 2bb2ed6c4..000000000 --- a/sapl/parlamentares/migrations/0008_auto_20151126_1332.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0007_auto_20151123_1258'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='cod_casa', - field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Cód. Casa'), - ), - migrations.AlterField( - model_name='parlamentar', - name='nome_parlamentar', - field=models.CharField(default=1, verbose_name='Nome Parlamentar', max_length=50), - preserve_default=False, - ), - ] diff --git a/sapl/parlamentares/migrations/0009_auto_20151126_1334.py b/sapl/parlamentares/migrations/0009_auto_20151126_1334.py deleted file mode 100644 index 839845351..000000000 --- a/sapl/parlamentares/migrations/0009_auto_20151126_1334.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0008_auto_20151126_1332'), - ] - - operations = [ - migrations.RemoveField( - model_name='parlamentar', - name='cod_casa', - ), - migrations.RemoveField( - model_name='parlamentar', - name='unidade_deliberativa', - ), - ] diff --git a/sapl/parlamentares/migrations/0010_auto_20160107_1850.py b/sapl/parlamentares/migrations/0010_auto_20160107_1850.py deleted file mode 100644 index bee171cd3..000000000 --- a/sapl/parlamentares/migrations/0010_auto_20160107_1850.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import sapl.parlamentares.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0009_auto_20151126_1334'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='fotografia', - field=models.ImageField(null=True, verbose_name='Fotografia', - blank=True, upload_to=sapl.parlamentares.models.foto_upload_path), - ), - ] diff --git a/sapl/parlamentares/migrations/0011_auto_20160216_1015.py b/sapl/parlamentares/migrations/0011_auto_20160216_1015.py deleted file mode 100644 index 4dacac89f..000000000 --- a/sapl/parlamentares/migrations/0011_auto_20160216_1015.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0010_auto_20160107_1850'), - ] - - operations = [ - migrations.AlterField( - model_name='dependente', - name='cpf', - field=models.CharField(verbose_name='CPF', max_length=14, blank=True), - ), - migrations.AlterField( - model_name='dependente', - name='rg', - field=models.CharField(verbose_name='RG', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='dependente', - name='titulo_eleitor', - field=models.CharField(verbose_name='Nº Título Eleitor', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='mandato', - name='observacao', - field=models.TextField(verbose_name='Observação', blank=True), - ), - migrations.AlterField( - model_name='municipio', - name='nome', - field=models.CharField(max_length=50, blank=True), - ), - migrations.AlterField( - model_name='municipio', - name='regiao', - field=models.CharField(blank=True, choices=[('CO', 'Centro-Oeste'), ('NE', 'Nordeste'), ('NO', 'Norte'), ('SE', 'Sudeste'), ('SL', 'Sul'), ('EX', 'Exterior')], max_length=2), - ), - migrations.AlterField( - model_name='municipio', - name='uf', - field=models.CharField(blank=True, choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=2), - ), - migrations.AlterField( - model_name='parlamentar', - name='biografia', - field=models.TextField(verbose_name='Biografia', blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='cep_residencia', - field=models.CharField(verbose_name='CEP', max_length=9, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='cpf', - field=models.CharField(verbose_name='C.P.F', max_length=14, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='email', - field=models.CharField(verbose_name='Correio Eletrônico', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='endereco_residencia', - field=models.CharField(verbose_name='Endereço Residencial', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='endereco_web', - field=models.CharField(verbose_name='HomePage', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='fax', - field=models.CharField(verbose_name='Fax', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='fax_residencia', - field=models.CharField(verbose_name='Fax Residencial', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='locais_atuacao', - field=models.CharField(verbose_name='Locais de Atuação', max_length=100, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='numero_gab_parlamentar', - field=models.CharField(verbose_name='Nº Gabinete', max_length=10, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='profissao', - field=models.CharField(verbose_name='Profissão', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='rg', - field=models.CharField(verbose_name='R.G.', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='telefone', - field=models.CharField(verbose_name='Telefone', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='telefone_residencia', - field=models.CharField(verbose_name='Telefone Residencial', max_length=50, blank=True), - ), - migrations.AlterField( - model_name='parlamentar', - name='titulo_eleitor', - field=models.CharField(verbose_name='Título de Eleitor', max_length=15, blank=True), - ), - migrations.AlterField( - model_name='tipoafastamento', - name='dispositivo', - field=models.CharField(verbose_name='Dispositivo', max_length=50, blank=True), - ), - ] diff --git a/sapl/parlamentares/migrations/0012_auto_20160307_0905.py b/sapl/parlamentares/migrations/0012_auto_20160307_0905.py deleted file mode 100644 index c3d0cac90..000000000 --- a/sapl/parlamentares/migrations/0012_auto_20160307_0905.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0011_auto_20160216_1015'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='email', - field=models.EmailField(blank=True, max_length=100, verbose_name='E-mail'), - ), - migrations.AlterField( - model_name='parlamentar', - name='endereco_web', - field=models.URLField(blank=True, max_length=100, verbose_name='HomePage'), - ), - ] diff --git a/sapl/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py b/sapl/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py deleted file mode 100644 index 6c6e63bcd..000000000 --- a/sapl/parlamentares/migrations/0012_parlamentar_unidade_deliberativa.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 17:58 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0011_auto_20160216_1015'), - ] - - operations = [ - migrations.AddField( - model_name='parlamentar', - name='unidade_deliberativa', - field=models.BooleanField(default=True, verbose_name='Unidade Deliberativa'), - preserve_default=False, - ), - ] diff --git a/sapl/parlamentares/migrations/0013_merge.py b/sapl/parlamentares/migrations/0013_merge.py deleted file mode 100644 index 0d555de78..000000000 --- a/sapl/parlamentares/migrations/0013_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-10 17:06 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0012_parlamentar_unidade_deliberativa'), - ('parlamentares', '0012_auto_20160307_0905'), - ] - - operations = [ - ] diff --git a/sapl/parlamentares/migrations/0014_auto_20160318_1504.py b/sapl/parlamentares/migrations/0014_auto_20160318_1504.py deleted file mode 100644 index 86170086d..000000000 --- a/sapl/parlamentares/migrations/0014_auto_20160318_1504.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-18 18:04 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0013_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='unidade_deliberativa', - field=models.BooleanField(default=False, verbose_name='Unidade Deliberativa'), - ), - ] diff --git a/sapl/parlamentares/migrations/0015_auto_20160322_1401.py b/sapl/parlamentares/migrations/0015_auto_20160322_1401.py deleted file mode 100644 index 38df99e38..000000000 --- a/sapl/parlamentares/migrations/0015_auto_20160322_1401.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-22 17:01 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0014_auto_20160318_1504'), - ] - - operations = [ - migrations.AlterField( - model_name='mandato', - name='data_expedicao_diploma', - field=models.DateField(verbose_name='Expedição do Diploma'), - ), - migrations.AlterField( - model_name='mandato', - name='data_fim_mandato', - field=models.DateField(verbose_name='Fim do Mandato'), - ), - ] diff --git a/sapl/parlamentares/migrations/0016_auto_20160404_1409.py b/sapl/parlamentares/migrations/0016_auto_20160404_1409.py deleted file mode 100644 index a10fb6c38..000000000 --- a/sapl/parlamentares/migrations/0016_auto_20160404_1409.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-04 17:09 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.parlamentares.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0015_auto_20160322_1401'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='fotografia', - field=models.ImageField(blank=True, null=True, upload_to=sapl.parlamentares.models.foto_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Fotografia'), - ), - ] diff --git a/sapl/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py b/sapl/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py deleted file mode 100644 index be2e861fe..000000000 --- a/sapl/parlamentares/migrations/0017_remove_parlamentar_unidade_deliberativa.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-04-28 13:20 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0016_auto_20160404_1409'), - ] - - operations = [ - migrations.RemoveField( - model_name='parlamentar', - name='unidade_deliberativa', - ), - ] diff --git a/sapl/parlamentares/migrations/0018_auto_20160510_0943.py b/sapl/parlamentares/migrations/0018_auto_20160510_0943.py deleted file mode 100644 index 7546f4001..000000000 --- a/sapl/parlamentares/migrations/0018_auto_20160510_0943.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-10 12:43 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0017_remove_parlamentar_unidade_deliberativa'), - ] - - operations = [ - migrations.AlterModelOptions( - name='filiacao', - options={'ordering': ('parlamentar', '-data', '-data_desfiliacao'), 'verbose_name': 'Filiação', 'verbose_name_plural': 'Filiações'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0019_auto_20160518_1136.py b/sapl/parlamentares/migrations/0019_auto_20160518_1136.py deleted file mode 100644 index f391c8be8..000000000 --- a/sapl/parlamentares/migrations/0019_auto_20160518_1136.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-18 14:36 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0018_auto_20160510_0943'), - ] - - operations = [ - migrations.AlterField( - model_name='composicaocoligacao', - name='partido', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Partido', verbose_name='Partido'), - ), - ] diff --git a/sapl/parlamentares/migrations/0019_auto_20160518_1204.py b/sapl/parlamentares/migrations/0019_auto_20160518_1204.py deleted file mode 100644 index 573a5a3ab..000000000 --- a/sapl/parlamentares/migrations/0019_auto_20160518_1204.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-18 15:04 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0018_auto_20160510_0943'), - ] - - operations = [ - migrations.AlterModelOptions( - name='legislatura', - options={'ordering': ['-data_inicio'], 'verbose_name': 'Legislatura', 'verbose_name_plural': 'Legislaturas'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0020_auto_20160518_1201.py b/sapl/parlamentares/migrations/0020_auto_20160518_1201.py deleted file mode 100644 index 2fb59f220..000000000 --- a/sapl/parlamentares/migrations/0020_auto_20160518_1201.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-18 15:01 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0019_auto_20160518_1136'), - ] - - operations = [ - migrations.AlterField( - model_name='composicaocoligacao', - name='partido', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Partido', verbose_name='Partidos da Coligação'), - ), - ] diff --git a/sapl/parlamentares/migrations/0021_merge.py b/sapl/parlamentares/migrations/0021_merge.py deleted file mode 100644 index e29731513..000000000 --- a/sapl/parlamentares/migrations/0021_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-19 14:18 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0019_auto_20160518_1204'), - ('parlamentares', '0020_auto_20160518_1201'), - ] - - operations = [ - ] diff --git a/sapl/parlamentares/migrations/0022_auto_20160624_1124.py b/sapl/parlamentares/migrations/0022_auto_20160624_1124.py deleted file mode 100644 index a395bc806..000000000 --- a/sapl/parlamentares/migrations/0022_auto_20160624_1124.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-24 14:24 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion -import sapl.parlamentares.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0021_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='sessaolegislativa', - name='legislatura', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Legislatura', verbose_name=sapl.parlamentares.models.Legislatura), - ), - ] diff --git a/sapl/parlamentares/migrations/0022_auto_20160702_1519.py b/sapl/parlamentares/migrations/0022_auto_20160702_1519.py deleted file mode 100644 index 6573268e1..000000000 --- a/sapl/parlamentares/migrations/0022_auto_20160702_1519.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-07-02 18:19 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0021_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='sessaolegislativa', - name='legislatura', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Legislatura', verbose_name='Legislatura'), - ), - ] diff --git a/sapl/parlamentares/migrations/0023_auto_20160628_1247.py b/sapl/parlamentares/migrations/0023_auto_20160628_1247.py deleted file mode 100644 index d40680e48..000000000 --- a/sapl/parlamentares/migrations/0023_auto_20160628_1247.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-28 15:47 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0022_auto_20160624_1124'), - ] - - operations = [ - migrations.AlterField( - model_name='sessaolegislativa', - name='legislatura', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Legislatura', verbose_name='Legislatura'), - ), - ] diff --git a/sapl/parlamentares/migrations/0024_merge.py b/sapl/parlamentares/migrations/0024_merge.py deleted file mode 100644 index f8e63c317..000000000 --- a/sapl/parlamentares/migrations/0024_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-18 21:39 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0022_auto_20160702_1519'), - ('parlamentares', '0023_auto_20160628_1247'), - ] - - operations = [ - ] diff --git a/sapl/parlamentares/migrations/0025_auto_20160916_1030.py b/sapl/parlamentares/migrations/0025_auto_20160916_1030.py deleted file mode 100644 index 7a8f3fabe..000000000 --- a/sapl/parlamentares/migrations/0025_auto_20160916_1030.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 13:30 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0024_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='ativo', - field=models.BooleanField(db_index=True, verbose_name='Ativo na Casa?'), - ), - ] diff --git a/sapl/parlamentares/migrations/0025_frente.py b/sapl/parlamentares/migrations/0025_frente.py deleted file mode 100644 index 1ba6cdb15..000000000 --- a/sapl/parlamentares/migrations/0025_frente.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 13:25 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0024_merge'), - ] - - operations = [ - migrations.CreateModel( - name='Frente', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('nome', models.CharField(max_length=80, verbose_name='Nome da Frente')), - ('data_criacao', models.DateField(verbose_name='Data Criação')), - ('data_extincao', models.DateField(blank=True, verbose_name='Data Dissolução')), - ('descricao', models.TextField(blank=True, verbose_name='Descrição')), - ('parlamentares', models.ManyToManyField(blank=True, to='parlamentares.Parlamentar', verbose_name='Parlamentares')), - ], - options={ - 'verbose_name': 'Frente', - 'verbose_name_plural': 'Frentes', - }, - ), - ] diff --git a/sapl/parlamentares/migrations/0026_auto_20160916_1034.py b/sapl/parlamentares/migrations/0026_auto_20160916_1034.py deleted file mode 100644 index fecddb39a..000000000 --- a/sapl/parlamentares/migrations/0026_auto_20160916_1034.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 13:34 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0025_frente'), - ] - - operations = [ - migrations.AlterField( - model_name='frente', - name='data_extincao', - field=models.DateField(blank=True, null=True, verbose_name='Data Dissolução'), - ), - ] diff --git a/sapl/parlamentares/migrations/0027_merge.py b/sapl/parlamentares/migrations/0027_merge.py deleted file mode 100644 index f71a6160b..000000000 --- a/sapl/parlamentares/migrations/0027_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-16 14:44 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0026_auto_20160916_1034'), - ('parlamentares', '0025_auto_20160916_1030'), - ] - - operations = [ - ] diff --git a/sapl/parlamentares/migrations/0028_auto_20160922_1443.py b/sapl/parlamentares/migrations/0028_auto_20160922_1443.py deleted file mode 100644 index 23efc2489..000000000 --- a/sapl/parlamentares/migrations/0028_auto_20160922_1443.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-22 17:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0027_merge'), - ] - - operations = [ - migrations.RemoveField( - model_name='tipoafastamento', - name='afastamento', - ), - migrations.RemoveField( - model_name='tipoafastamento', - name='fim_mandato', - ), - migrations.AddField( - model_name='tipoafastamento', - name='indicador', - field=models.CharField(choices=[('A', 'Afastamento'), ('F', 'Fim de Mandato')], default='F', max_length=1, verbose_name='Indicador'), - ), - ] diff --git a/sapl/parlamentares/migrations/0028_legislatura_numero.py b/sapl/parlamentares/migrations/0028_legislatura_numero.py deleted file mode 100644 index 465c1b764..000000000 --- a/sapl/parlamentares/migrations/0028_legislatura_numero.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-21 15:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0027_merge'), - ] - - operations = [ - migrations.AddField( - model_name='legislatura', - name='numero', - field=models.PositiveIntegerField(default=1, verbose_name='Número'), - preserve_default=False, - ), - ] diff --git a/sapl/parlamentares/migrations/0029_merge.py b/sapl/parlamentares/migrations/0029_merge.py deleted file mode 100644 index 034f452a4..000000000 --- a/sapl/parlamentares/migrations/0029_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-22 20:52 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0028_auto_20160922_1443'), - ('parlamentares', '0028_legislatura_numero'), - ] - - operations = [ - ] diff --git a/sapl/parlamentares/migrations/0030_auto_20160928_0846.py b/sapl/parlamentares/migrations/0030_auto_20160928_0846.py deleted file mode 100644 index 04c88a009..000000000 --- a/sapl/parlamentares/migrations/0030_auto_20160928_0846.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-28 11:46 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0029_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='tipodependente', - name='descricao', - field=models.CharField(max_length=50, verbose_name='Descrição'), - ), - ] diff --git a/sapl/parlamentares/migrations/0031_auto_20160929_1842.py b/sapl/parlamentares/migrations/0031_auto_20160929_1842.py deleted file mode 100644 index 6e920f5d5..000000000 --- a/sapl/parlamentares/migrations/0031_auto_20160929_1842.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-29 21:42 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0030_auto_20160928_0846'), - ] - - operations = [ - migrations.AlterModelOptions( - name='sessaolegislativa', - options={'ordering': ['-data_inicio', '-data_fim'], 'verbose_name': 'Sessão Legislativa', 'verbose_name_plural': 'Sessões Legislativas'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0032_frenteproxymasterdetail.py b/sapl/parlamentares/migrations/0032_frenteproxymasterdetail.py deleted file mode 100644 index 8974be563..000000000 --- a/sapl/parlamentares/migrations/0032_frenteproxymasterdetail.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-30 20:09 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0031_auto_20160929_1842'), - ] - - operations = [ - migrations.CreateModel( - name='FrenteProxyMasterDetail', - fields=[ - ], - options={ - 'proxy': True, - }, - bases=('parlamentares.frente',), - ), - ] diff --git a/sapl/parlamentares/migrations/0033_auto_20160930_1715.py b/sapl/parlamentares/migrations/0033_auto_20160930_1715.py deleted file mode 100644 index 14591d16c..000000000 --- a/sapl/parlamentares/migrations/0033_auto_20160930_1715.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-30 20:15 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0032_frenteproxymasterdetail'), - ] - - operations = [ - migrations.DeleteModel( - name='FrenteProxyMasterDetail', - ), - migrations.CreateModel( - name='FrenteParlamentar', - fields=[ - ], - options={ - 'proxy': True, - 'verbose_name': 'Frente', - 'verbose_name_plural': 'Frentes', - }, - bases=('parlamentares.frente',), - ), - ] diff --git a/sapl/parlamentares/migrations/0034_delete_frenteparlamentar.py b/sapl/parlamentares/migrations/0034_delete_frenteparlamentar.py deleted file mode 100644 index 4c5e8d710..000000000 --- a/sapl/parlamentares/migrations/0034_delete_frenteparlamentar.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-30 21:43 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0033_auto_20160930_1715'), - ] - - operations = [ - migrations.DeleteModel( - name='FrenteParlamentar', - ), - ] diff --git a/sapl/parlamentares/migrations/0035_auto_20161011_0840.py b/sapl/parlamentares/migrations/0035_auto_20161011_0840.py deleted file mode 100644 index 0b324e3e5..000000000 --- a/sapl/parlamentares/migrations/0035_auto_20161011_0840.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-11 11:40 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0034_delete_frenteparlamentar'), - ] - - operations = [ - migrations.AlterField( - model_name='parlamentar', - name='ativo', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], db_index=True, default=False, verbose_name='Ativo na Casa?'), - ), - ] diff --git a/sapl/parlamentares/migrations/0036_partido_logo_partido.py b/sapl/parlamentares/migrations/0036_partido_logo_partido.py deleted file mode 100644 index a234fbf6c..000000000 --- a/sapl/parlamentares/migrations/0036_partido_logo_partido.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2016-12-16 16:40 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.parlamentares.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0035_auto_20161011_0840'), - ] - - operations = [ - migrations.AddField( - model_name='partido', - name='logo_partido', - field=models.ImageField(blank=True, null=True, upload_to=sapl.parlamentares.models.logo_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_img], verbose_name='Logo Partido'), - ), - ] diff --git a/sapl/parlamentares/migrations/0037_votante.py b/sapl/parlamentares/migrations/0037_votante.py deleted file mode 100644 index fca67dec4..000000000 --- a/sapl/parlamentares/migrations/0037_votante.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-09 15:18 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('parlamentares', '0036_partido_logo_partido'), - ] - - operations = [ - migrations.CreateModel( - name='Votante', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('data', models.DateTimeField(auto_now_add=True, max_length=30, null=True, verbose_name='Data')), - ('ip', models.CharField(blank=True, max_length=30, null=True, verbose_name='IP')), - ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parlamentar', to='parlamentares.Parlamentar', verbose_name='Parlamentar')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='User')), - ], - options={ - 'verbose_name': 'Votantes', - }, - ), - ] diff --git a/sapl/parlamentares/migrations/0038_auto_20170213_1425.py b/sapl/parlamentares/migrations/0038_auto_20170213_1425.py deleted file mode 100644 index 7134cef57..000000000 --- a/sapl/parlamentares/migrations/0038_auto_20170213_1425.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-13 14:25 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0037_votante'), - ] - - operations = [ - migrations.AlterModelOptions( - name='votante', - options={'verbose_name': 'Usuários'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0039_remove_votante_ip.py b/sapl/parlamentares/migrations/0039_remove_votante_ip.py deleted file mode 100644 index 9ae65babd..000000000 --- a/sapl/parlamentares/migrations/0039_remove_votante_ip.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-13 14:26 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0038_auto_20170213_1425'), - ] - - operations = [ - migrations.RemoveField( - model_name='votante', - name='ip', - ), - ] diff --git a/sapl/parlamentares/migrations/0040_auto_20170214_1709.py b/sapl/parlamentares/migrations/0040_auto_20170214_1709.py deleted file mode 100644 index 5c28f30ca..000000000 --- a/sapl/parlamentares/migrations/0040_auto_20170214_1709.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2017-02-14 17:09 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0039_remove_votante_ip'), - ] - - operations = [ - migrations.AlterModelOptions( - name='votante', - options={'permissions': (('can_vote', 'Can Vote'),), 'verbose_name': 'Usuário', 'verbose_name_plural': 'Usuários'}, - ), - ] diff --git a/sapl/parlamentares/migrations/0041_mandato_titular.py b/sapl/parlamentares/migrations/0041_mandato_titular.py deleted file mode 100644 index 69f0c768a..000000000 --- a/sapl/parlamentares/migrations/0041_mandato_titular.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-16 13:24 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0040_auto_20170214_1709'), - ] - - operations = [ - migrations.AddField( - model_name='mandato', - name='titular', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], db_index=True, default=True, verbose_name='Vereador Titular'), - ), - ] diff --git a/sapl/parlamentares/models.py b/sapl/parlamentares/models.py index e134cad8a..4d15ab6fd 100644 --- a/sapl/parlamentares/models.py +++ b/sapl/parlamentares/models.py @@ -1,7 +1,6 @@ from datetime import datetime import reversion -from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices @@ -55,6 +54,7 @@ class SessaoLegislativa(models.Model): legislatura = models.ForeignKey( Legislatura, + on_delete=models.PROTECT, verbose_name=Legislatura._meta.verbose_name) numero = models.PositiveIntegerField(verbose_name=_('Número')) tipo = models.CharField( @@ -80,10 +80,13 @@ class SessaoLegislativa(models.Model): @reversion.register() class Coligacao(models.Model): - legislatura = models.ForeignKey(Legislatura, verbose_name=_('Legislatura')) + legislatura = models.ForeignKey(Legislatura, + on_delete=models.PROTECT, + verbose_name=_('Legislatura')) nome = models.CharField(max_length=50, verbose_name=_('Nome')) numero_votos = models.PositiveIntegerField( - blank=True, null=True, verbose_name=_('Nº Votos Recebidos')) + blank=True, null=True, + verbose_name=_('Nº Votos Recebidos (Coligação)')) class Meta: verbose_name = _('Coligação') @@ -130,8 +133,9 @@ class Partido(models.Model): class ComposicaoColigacao(models.Model): # TODO M2M partido = models.ForeignKey(Partido, + on_delete=models.PROTECT, verbose_name=_('Partidos da Coligação')) - coligacao = models.ForeignKey(Coligacao) + coligacao = models.ForeignKey(Coligacao, on_delete=models.PROTECT) class Meta: verbose_name = (_('Composição Coligação')) @@ -213,11 +217,13 @@ class Parlamentar(models.Model): NivelInstrucao, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Nível Instrução')) situacao_militar = models.ForeignKey( SituacaoMilitar, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Situação Militar')) nome_completo = models.CharField( max_length=50, verbose_name=_('Nome Completo')) @@ -247,7 +253,8 @@ class Parlamentar(models.Model): blank=True, verbose_name=_('Endereço Residencial')) municipio_residencia = models.ForeignKey( - Municipio, blank=True, null=True, verbose_name=_('Município')) + Municipio, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Município')) cep_residencia = models.CharField( max_length=9, blank=True, verbose_name=_('CEP')) telefone_residencia = models.CharField( @@ -363,8 +370,9 @@ class Dependente(models.Model): SEXO_CHOICE = ((FEMININO, _('Feminino')), (MASCULINO, _('Masculino'))) - tipo = models.ForeignKey(TipoDependente, verbose_name=_('Tipo')) - parlamentar = models.ForeignKey(Parlamentar) + tipo = models.ForeignKey(TipoDependente, on_delete=models.PROTECT, + verbose_name=_('Tipo')) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) nome = models.CharField(max_length=50, verbose_name=_('Nome')) sexo = models.CharField( max_length=1, verbose_name=_('Sexo'), choices=SEXO_CHOICE) @@ -390,8 +398,10 @@ class Dependente(models.Model): @reversion.register() class Filiacao(models.Model): data = models.DateField(verbose_name=_('Data Filiação')) - parlamentar = models.ForeignKey(Parlamentar) - partido = models.ForeignKey(Partido, verbose_name=_('Partido')) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) + partido = models.ForeignKey(Partido, + on_delete=models.PROTECT, + verbose_name=_('Partido')) data_desfiliacao = models.DateField( blank=True, null=True, verbose_name=_('Data Desfiliação')) @@ -427,17 +437,19 @@ class TipoAfastamento(models.Model): @reversion.register() class Mandato(models.Model): - parlamentar = models.ForeignKey(Parlamentar) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) tipo_afastamento = models.ForeignKey( - TipoAfastamento, blank=True, null=True) - legislatura = models.ForeignKey(Legislatura, verbose_name=_('Legislatura')) + TipoAfastamento, blank=True, null=True, on_delete=models.PROTECT) + legislatura = models.ForeignKey(Legislatura, on_delete=models.PROTECT, + verbose_name=_('Legislatura')) coligacao = models.ForeignKey( - Coligacao, blank=True, null=True, verbose_name=_('Coligação')) + Coligacao, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Coligação')) # TODO what is this field?????? tipo_causa_fim_mandato = models.PositiveIntegerField(blank=True, null=True) data_fim_mandato = models.DateField(verbose_name=_('Fim do Mandato')) votos_recebidos = models.PositiveIntegerField( - blank=True, null=True, verbose_name=_('Votos Recebidos')) + blank=True, null=True, verbose_name=_('Votos Recebidos (Mandato)')) data_expedicao_diploma = models.DateField( verbose_name=_('Expedição do Diploma')) titular = models.BooleanField( @@ -445,7 +457,7 @@ class Mandato(models.Model): default=True, choices=YES_NO_CHOICES, verbose_name=_('Vereador Titular')) - + observacao = models.TextField( blank=True, verbose_name=_('Observação')) @@ -489,9 +501,10 @@ class CargoMesa(models.Model): @reversion.register() class ComposicaoMesa(models.Model): # TODO M2M ???? Ternary????? - parlamentar = models.ForeignKey(Parlamentar) - sessao_legislativa = models.ForeignKey(SessaoLegislativa) - cargo = models.ForeignKey(CargoMesa) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) + sessao_legislativa = models.ForeignKey(SessaoLegislativa, + on_delete=models.PROTECT) + cargo = models.ForeignKey(CargoMesa, on_delete=models.PROTECT) class Meta: verbose_name = _('Ocupação de cargo na Mesa') @@ -546,9 +559,10 @@ class Frente(models.Model): class Votante(models.Model): parlamentar = models.ForeignKey( - Parlamentar, verbose_name=_('Parlamentar'), related_name='parlamentar') + Parlamentar, verbose_name=_('Parlamentar'), + on_delete=models.PROTECT, related_name='parlamentar') user = models.ForeignKey( - get_settings_auth_user_model(), + get_settings_auth_user_model(), on_delete=models.PROTECT, verbose_name=_('User'), related_name='user') data = models.DateTimeField( verbose_name=_('Data'), auto_now_add=True, diff --git a/sapl/parlamentares/tests/test_parlamentares.py b/sapl/parlamentares/tests/test_parlamentares.py index 6881b7a18..b71816d5b 100644 --- a/sapl/parlamentares/tests/test_parlamentares.py +++ b/sapl/parlamentares/tests/test_parlamentares.py @@ -122,9 +122,9 @@ def test_mandato_submit(admin_client): mommy.make(Parlamentar, pk=14) mommy.make(Legislatura, pk=5) - response = admin_client.post(reverse('sapl.parlamentares:mandato_create', + admin_client.post(reverse('sapl.parlamentares:mandato_create', kwargs={'pk': 14}), - {'parlamentar': 14, # hidden field + {'parlamentar': 14, # hidden field 'legislatura': 5, 'data_fim_mandato': '2016-01-01', 'data_expedicao_diploma': '2016-03-22', diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py index 1d9885053..0d8d406da 100644 --- a/sapl/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -1,14 +1,19 @@ from django.conf.urls import include, url -from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, +from sapl.parlamentares.views import (altera_field_mesa, + altera_field_mesa_public_view, + CargoMesaCrud, ColigacaoCrud, ComposicaoColigacaoCrud, DependenteCrud, FiliacaoCrud, FrenteCrud, FrenteList, - LegislaturaCrud, MandatoCrud, + LegislaturaCrud, + insere_parlamentar_composicao, + MandatoCrud, MesaDiretoraView, NivelInstrucaoCrud, ParlamentarCrud, ParticipacaoParlamentarCrud, PartidoCrud, ProposicaoParlamentarCrud, RelatoriaParlamentarCrud, + remove_parlamentar_composicao, SessaoLegislativaCrud, TipoAfastamentoCrud, TipoDependenteCrud, TipoMilitarCrud, VotanteView) @@ -51,4 +56,16 @@ urlpatterns = [ url(r'^mesa-diretora/$', MesaDiretoraView.as_view(), name='mesa_diretora'), + + url(r'^mesa-diretora/altera-field-mesa/$', + altera_field_mesa, name='altera_field_mesa'), + + url(r'^mesa-diretora/altera-field-mesa-public-view/$', + altera_field_mesa_public_view, name='altera_field_mesa_public_view'), + + url(r'^mesa-diretora/insere-parlamentar-composicao/$', + insere_parlamentar_composicao, name='insere_parlamentar_composicao'), + + url(r'^mesa-diretora/remove-parlamentar-composicao/$', + remove_parlamentar_composicao, name='remove_parlamentar_composicao'), ] diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 485439d93..f9dc33f60 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -1,6 +1,8 @@ from django.contrib import messages -from django.core.exceptions import ObjectDoesNotExist +from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.core.urlresolvers import reverse, reverse_lazy +from django.db.models import F, Q +from django.http import JsonResponse from django.http.response import HttpResponseRedirect from django.utils.datastructures import MultiValueDictKeyError from django.utils.translation import ugettext_lazy as _ @@ -60,8 +62,8 @@ class VotanteView(MasterDetailCrud): if obj.user: obj.user.delete() return HttpResponseRedirect( - reverse('sapl.parlamentares:votante_list', - kwargs={'pk': obj.parlamentar.pk})) + reverse('sapl.parlamentares:votante_list', + kwargs={'pk': obj.parlamentar.pk})) class FrenteList(MasterDetailCrud): @@ -107,7 +109,7 @@ class ProposicaoParlamentarCrud(CrudBaseForListAndDetailExternalAppView): def get_context_data(self, **kwargs): context = CrudBaseForListAndDetailExternalAppView\ - .ListView.get_context_data(self, **kwargs) + .ListView.get_context_data(self, **kwargs) context['title'] = context['title'].replace( 'Proposições', 'Matérias') return context @@ -264,7 +266,11 @@ class ParlamentarCrud(Crud): class BaseMixin(Crud.BaseMixin): ordered_list = False list_field_names = [ - 'avatar_html', 'nome_parlamentar', 'filiacao_atual', 'ativo'] + 'avatar_html', + 'nome_parlamentar', + 'filiacao_atual', + 'ativo', + 'mandato_titular'] class DetailView(Crud.DetailView): @@ -310,7 +316,8 @@ class ParlamentarCrud(Crud): legislatura_id = self.take_legislatura_id() if legislatura_id != 0: return queryset.filter( - mandato__legislatura_id=legislatura_id) + mandato__legislatura_id=legislatura_id).annotate( + mandato_titular=F('mandato__titular')) else: try: l = Legislatura.objects.all().order_by( @@ -320,10 +327,13 @@ class ParlamentarCrud(Crud): else: if l is None: return Legislatura.objects.all() - return queryset.filter(mandato__legislatura_id=l) + return queryset.filter(mandato__legislatura_id=l).annotate( + mandato_titular=F('mandato__titular')) def get_headers(self): - return ['', _('Parlamentar'), _('Partido'), _('Ativo?')] + return ['', + _('Parlamentar'), _('Partido'), + _('Ativo?'), _('Titular?')] def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -335,8 +345,45 @@ class ParlamentarCrud(Crud): # Tira Link do avatar_html e coloca no nome for row in context['rows']: + # Coloca a filiação atual ao invés da última + if row[0][1]: + # Pega o Parlamentar por meio da pk + parlamentar = Parlamentar.objects.get( + id=(row[0][1].split('/')[-1])) + + # Pega a Legislatura + legislatura = Legislatura.objects.get( + id=context['legislatura_id']) + + # As condições para mostrar a filiação são: + # A data de filiacao deve ser menor que a data de fim + # da legislatura e data de desfiliação deve nula, ou maior, + # ou igual a data de fim da legislatura + try: + filiacao = parlamentar.filiacao_set.get(Q( + data__lte=legislatura.data_fim, + data_desfiliacao__gte=legislatura.data_fim) | Q( + data__lte=legislatura.data_fim, + data_desfiliacao__isnull=True)) + + # Caso não exista filiação com essas condições + except ObjectDoesNotExist: + row[2] = ('Não possui filiação', None) + + # Caso exista mais de uma filiação nesse intervalo + # Entretanto, NÃO DEVE OCORRER + except MultipleObjectsReturned: + row[2] = ( + 'O Parlamentar possui duas filiações conflitantes', + None) + + # Caso encontre UMA filiação nessas condições + else: + row[2] = (filiacao.partido.sigla, None) + row[1] = (row[1][0], row[0][1]) row[0] = (row[0][0], None) + return context @@ -386,6 +433,11 @@ class MesaDiretoraView(FormView): [p.parlamentar for p in parlamentares]) - set( parlamentares_ocupados)) + # Se todos os cargos estiverem ocupados, a listagem de parlamentares + # deve ser renderizada vazia + if not cargos_vagos: + parlamentares_vagos = [] + return self.render_to_response( {'legislaturas': Legislatura.objects.all( ).order_by('-numero'), @@ -399,107 +451,229 @@ class MesaDiretoraView(FormView): 'cargos_vagos': cargos_vagos }) - def existe_membro_mesa(self, sessao_plenaria, cargo): - return ComposicaoMesa.objects.filter( - sessao_legislativa_id=sessao_plenaria.id, - # parlamentar_id = integrante.parlamentar_id, - cargo_id=cargo.id - ).exists() - def post(self, request, *args, **kwargs): - - if (not Legislatura.objects.exists() or - not SessaoLegislativa.objects.exists()): - return self.validation(request) - - if 'Incluir' in request.POST and request.user.has_perm( - '%s.add_%s' % ( - AppConfig.label, ComposicaoMesa._meta.model_name)): - - composicao = ComposicaoMesa() - - try: - composicao.sessao_legislativa = SessaoLegislativa.objects.get( - id=int(request.POST['sessao'])) - except MultiValueDictKeyError: - messages.error(request, _( - 'Nenhuma sessão foi inserida!')) - return self.get(request) - - try: - composicao.parlamentar = Parlamentar.objects.get( - id=int(request.POST['parlamentar'])) - except MultiValueDictKeyError: - messages.error(request, _( - 'Nenhum parlamentar foi inserido!')) - return self.get(request) - - try: - composicao.cargo = CargoMesa.objects.get( - id=int(request.POST['cargo'])) - if self.existe_membro_mesa(composicao.sessao_legislativa, - composicao.cargo): - messages.error(request, _('Parlamentar já inserido!')) - return self.get(request) - - composicao.save() - except MultiValueDictKeyError: - messages.error(request, _( - 'Nenhum cargo foi inserido!')) - return self.get(request) - - messages.success(request, _( - 'Parlamentar adicionado com sucesso!')) - - elif 'Excluir' in request.POST and request.user.has_perm( - '%s.delete_%s' % ( - AppConfig.label, ComposicaoMesa._meta.model_name)): +def altera_field_mesa(request): + """ + Essa função lida com qualquer alteração nos campos + da Mesa Diretora, após qualquer + operação (Legislatura/Sessão/Inclusão/Remoção), + atualizando os campos após cada alteração + """ + + legislatura = request.GET['legislatura'] + sessoes = SessaoLegislativa.objects.filter( + legislatura=legislatura).order_by('-data_inicio') + + if not sessoes: + return JsonResponse({'msg': ('Nenhuma sessão encontrada!', 0)}) + + # Verifica se já tem uma sessão selecionada. Ocorre quando + # é alterado o campo de sessão ou feita alguma operação + # de inclusão/remoção. + if request.GET['sessao']: + sessao_selecionada = request.GET['sessao'] + # Caso a mudança tenha sido no campo legislatura, a sessão + # atual deve ser a primeira daquela legislatura + else: + sessao_selecionada = SessaoLegislativa.objects.filter( + legislatura=legislatura).order_by( + '-data_inicio').first().id + + # Atualiza os componentes da view após a mudança + composicao_mesa = ComposicaoMesa.objects.filter( + sessao_legislativa=sessao_selecionada) + + cargos_ocupados = [m.cargo for m in composicao_mesa] + cargos = CargoMesa.objects.all() + cargos_vagos = list(set(cargos) - set(cargos_ocupados)) + + parlamentares = Legislatura.objects.get( + id=legislatura).mandato_set.all() + parlamentares_ocupados = [m.parlamentar for m in composicao_mesa] + parlamentares_vagos = list( + set( + [p.parlamentar for p in parlamentares]) - set( + parlamentares_ocupados)) + + lista_sessoes = [(s.id, s.__str__()) for s in sessoes] + lista_composicao = [(c.id, c.parlamentar.__str__(), + c.cargo.__str__()) for c in composicao_mesa] + lista_parlamentares = [( + p.id, p.__str__()) for p in parlamentares_vagos] + lista_cargos = [(c.id, c.__str__()) for c in cargos_vagos] + + return JsonResponse( + {'lista_sessoes': lista_sessoes, + 'lista_composicao': lista_composicao, + 'lista_parlamentares': lista_parlamentares, + 'lista_cargos': lista_cargos, + 'sessao_selecionada': sessao_selecionada, + 'msg': ('', 1)}) + + +def insere_parlamentar_composicao(request): + """ + Essa função lida com qualquer operação de inserção + na composição da Mesa Diretora + """ + + if request.user.has_perm( + '%s.add_%s' % ( + AppConfig.label, ComposicaoMesa._meta.model_name)): + + composicao = ComposicaoMesa() + + try: + composicao.sessao_legislativa = SessaoLegislativa.objects.get( + id=int(request.POST['sessao'])) + except MultiValueDictKeyError: + return JsonResponse({'msg': ('Nenhuma sessão foi inserida!', 0)}) + + try: + composicao.parlamentar = Parlamentar.objects.get( + id=int(request.POST['parlamentar'])) + except MultiValueDictKeyError: + return JsonResponse({ + 'msg': ('Nenhum parlamentar foi inserido!', 0)}) + + try: + composicao.cargo = CargoMesa.objects.get( + id=int(request.POST['cargo'])) + parlamentar_ja_inserido = ComposicaoMesa.objects.filter( + sessao_legislativa_id=composicao.sessao_legislativa.id, + cargo_id=composicao.cargo.id).exists() + + if parlamentar_ja_inserido: + return JsonResponse({'msg': ('Parlamentar já inserido!', 0)}) + + composicao.save() + + except MultiValueDictKeyError: + return JsonResponse({'msg': ('Nenhum cargo foi inserido!', 0)}) + + return JsonResponse({'msg': ('Parlamentar inserido com sucesso!', 1)}) + + else: + return JsonResponse( + {'msg': ('Você não tem permissão para esta operação!', 0)}) + + +def remove_parlamentar_composicao(request): + """ + Essa função lida com qualquer operação de remoção + na composição da Mesa Diretora + """ + + if request.POST and request.user.has_perm( + '%s.delete_%s' % ( + AppConfig.label, ComposicaoMesa._meta.model_name)): if 'composicao_mesa' in request.POST: - ids = request.POST['composicao_mesa'].split(':') - composicao = ComposicaoMesa.objects.get( - sessao_legislativa_id=int(request.POST['sessao']), - parlamentar_id=int(ids[0]), - cargo_id=int(ids[1]) - ) - composicao.delete() - messages.success(request, _( - 'Parlamentar excluido com sucesso!')) - else: - messages.error(request, _( - 'Selecione um parlamentar para ser excluido!')) - - mesa = ComposicaoMesa.objects.filter( - sessao_legislativa=request.POST['sessao']) - - cargos_ocupados = [m.cargo for m in mesa] - cargos = CargoMesa.objects.all() - cargos_vagos = list(set(cargos) - set(cargos_ocupados)) - - parlamentares = Legislatura.objects.get( - id=int(request.POST['legislatura'])).mandato_set.all() - parlamentares_ocupados = [m.parlamentar for m in mesa] - parlamentares_vagos = list( - set( - [p.parlamentar for p in parlamentares]) - set( - parlamentares_ocupados)) - - sessao_sel = SessaoLegislativa.objects.get( - id=int(request.POST['sessao'])) + try: + composicao = ComposicaoMesa.objects.get( + id=request.POST['composicao_mesa']) + except ObjectDoesNotExist: + return JsonResponse( + {'msg': ( + 'Composição da Mesa não pôde ser removida!', 0)}) - if str(sessao_sel.legislatura_id) != request.POST['legislatura']: - sessao_sel = SessaoLegislativa.objects.filter( - legislatura=Legislatura.objects.first()).first() + composicao.delete() - return self.render_to_response( - {'legislaturas': Legislatura.objects.all( - ).order_by('-numero'), - 'legislatura_selecionada': Legislatura.objects.get( - id=int(request.POST['legislatura'])), - 'sessoes': SessaoLegislativa.objects.filter( - legislatura_id=int(request.POST['legislatura'])), - 'sessao_selecionada': sessao_sel, - 'composicao_mesa': mesa, - 'parlamentares': parlamentares_vagos, - 'cargos_vagos': cargos_vagos - }) + return JsonResponse( + {'msg': ( + 'Parlamentar excluido com sucesso!', 1)}) + else: + return JsonResponse( + {'msg': ( + 'Selecione algum parlamentar para ser excluido!', 0)}) + + +def partido_parlamentar_sessao_legislativa(sessao, parlamentar): + """ + Função para descobrir o partido do parlamentar durante + o período de uma dada Sessão Legislativa + """ + + # As condições para mostrar a filiação são: + # A data de filiacao deve ser menor que a data de fim + # da sessao legislativa e data de desfiliação deve nula, ou maior, + # ou igual a data de fim da sessao + try: + filiacao = parlamentar.filiacao_set.get(Q( + data__lte=sessao.data_fim, + data_desfiliacao__gte=sessao.data_fim) | Q( + data__lte=sessao.data_fim, + data_desfiliacao__isnull=True)) + + # Caso não exista filiação com essas condições + except ObjectDoesNotExist: + return '' + + # Caso exista mais de uma filiação nesse intervalo + # Entretanto, NÃO DEVE OCORRER + except MultipleObjectsReturned: + return 'O Parlamentar possui duas filiações conflitantes' + + # Caso encontre UMA filiação nessas condições + else: + return filiacao.partido.sigla + + +def altera_field_mesa_public_view(request): + """ + Essa função lida com qualquer alteração nos campos + da Mesa Diretora para usuários anônimos, + atualizando os campos após cada alteração + """ + + legislatura = request.GET['legislatura'] + sessoes = SessaoLegislativa.objects.filter( + legislatura=legislatura).order_by('-data_inicio') + + if not sessoes: + return JsonResponse({'msg': ('Nenhuma sessão encontrada!', 0)}) + + # Verifica se já tem uma sessão selecionada. Ocorre quando + # é alterado o campo de sessão + if request.GET['sessao']: + sessao_selecionada = request.GET['sessao'] + # Caso a mudança tenha sido no campo legislatura, a sessão + # atual deve ser a primeira daquela legislatura + else: + sessao_selecionada = sessoes.first().id + + # Atualiza os componentes da view após a mudança + lista_sessoes = [(s.id, s.__str__()) for s in sessoes] + + composicao_mesa = ComposicaoMesa.objects.filter( + sessao_legislativa=sessao_selecionada) + + cargos_ocupados = [(m.cargo.id, + m.cargo.__str__()) for m in composicao_mesa] + + parlamentares_ocupados = [(m.parlamentar.id, + m.parlamentar.__str__() + ) for m in composicao_mesa] + + lista_fotos = [] + lista_partidos = [] + + sessao = SessaoLegislativa.objects.get(id=sessao_selecionada) + for p in parlamentares_ocupados: + parlamentar = Parlamentar.objects.get(id=p[0]) + lista_partidos.append( + partido_parlamentar_sessao_legislativa(sessao, + parlamentar)) + if parlamentar.fotografia: + lista_fotos.append(parlamentar.fotografia.url) + else: + lista_fotos.append(None) + + return JsonResponse( + {'lista_parlamentares': parlamentares_ocupados, + 'lista_partidos': lista_partidos, + 'lista_cargos': cargos_ocupados, + 'lista_sessoes': lista_sessoes, + 'lista_fotos': lista_fotos, + 'sessao_selecionada': sessao_selecionada, + 'msg': ('', 1)}) diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 1caf5c569..d8f996fe3 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -544,10 +544,10 @@ class DocumentoAdministrativoForm(ModelForm): ano_protocolo = forms.ChoiceField(required=False, label=Protocolo._meta. - get_field('ano').verbose_name, + get_field('ano').verbose_name, choices=RANGE_ANOS, widget=forms.Select( - attrs={'class': 'selector'})) + attrs={'class': 'selector'})) class Meta: model = DocumentoAdministrativo diff --git a/sapl/protocoloadm/migrations/0001_initial.py b/sapl/protocoloadm/migrations/0001_initial.py index 5f9a851f8..c98e715bd 100644 --- a/sapl/protocoloadm/migrations/0001_initial.py +++ b/sapl/protocoloadm/migrations/0001_initial.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-06-24 14:31 +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion -import sapl.protocoloadm.models +import sapl.utils class Migration(migrations.Migration): @@ -12,7 +12,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('materia', '0038_auto_20160612_1506'), + ('base', '0001_initial'), + ('materia', '0001_initial'), ] operations = [ @@ -21,7 +22,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=30, verbose_name='Nome')), - ('arquivo', models.FileField(blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Arquivo')), + ('arquivo', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, verbose_name='Arquivo')), ('data', models.DateField(blank=True, null=True, verbose_name='Data')), ('autor', models.CharField(blank=True, max_length=50, verbose_name='Autor')), ('assunto', models.TextField(blank=True, verbose_name='Assunto')), @@ -37,7 +38,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('numero', models.PositiveIntegerField(verbose_name='Número')), - ('ano', models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')), + ('ano', models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')), ('data', models.DateField(verbose_name='Data')), ('numero_protocolo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Núm. Protocolo')), ('interessado', models.CharField(blank=True, max_length=50, verbose_name='Interessado')), @@ -46,8 +47,8 @@ class Migration(migrations.Migration): ('tramitacao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Em Tramitação?')), ('assunto', models.TextField(verbose_name='Assunto')), ('observacao', models.TextField(blank=True, verbose_name='Observação')), - ('texto_integral', models.FileField(blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Texto Integral')), - ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.Autor')), + ('texto_integral', models.FileField(blank=True, null=True, upload_to=sapl.utils.texto_upload_path, verbose_name='Texto Integral')), + ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.Autor')), ], options={ 'verbose_name': 'Documento Administrativo', @@ -59,11 +60,11 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('numero', models.PositiveIntegerField(verbose_name='Número de Protocolo')), - ('ano', models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo')), + ('ano', models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo')), ('data', models.DateField()), ('hora', models.TimeField()), ('timestamp', models.DateTimeField()), - ('tipo_protocolo', models.PositiveIntegerField(verbose_name='Tipo de Protocolo')), + ('tipo_protocolo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Tipo de Protocolo')), ('tipo_processo', models.PositiveIntegerField()), ('interessado', models.CharField(blank=True, max_length=60, verbose_name='Interessado')), ('assunto_ementa', models.TextField(blank=True)), @@ -74,9 +75,10 @@ class Migration(migrations.Migration): ('ip_anulacao', models.CharField(blank=True, max_length=15)), ('justificativa_anulacao', models.CharField(blank=True, max_length=60, verbose_name='Motivo')), ('timestamp_anulacao', models.DateTimeField(blank=True, null=True)), - ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.Autor')), + ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.Autor')), ], options={ + 'permissions': (('action_anular_protocolo', 'Permissão para Anular Protocolo'),), 'verbose_name': 'Protocolo', 'verbose_name_plural': 'Protocolos', }, @@ -102,21 +104,11 @@ class Migration(migrations.Migration): ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), ], options={ + 'ordering': ['descricao'], 'verbose_name': 'Tipo de Documento Administrativo', 'verbose_name_plural': 'Tipos de Documento Administrativo', }, ), - migrations.CreateModel( - name='TipoInstituicao', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ], - options={ - 'verbose_name': 'Tipo de Instituição', - 'verbose_name_plural': 'Tipos de Instituições', - }, - ), migrations.CreateModel( name='TramitacaoAdministrativo', fields=[ @@ -125,10 +117,10 @@ class Migration(migrations.Migration): ('data_encaminhamento', models.DateField(blank=True, null=True, verbose_name='Data Encaminhamento')), ('texto', models.TextField(blank=True, verbose_name='Texto da Ação')), ('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim do Prazo')), - ('documento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.DocumentoAdministrativo')), - ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.StatusTramitacaoAdministrativo', verbose_name='Status')), - ('unidade_tramitacao_destino', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino')), - ('unidade_tramitacao_local', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local')), + ('documento', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.DocumentoAdministrativo')), + ('status', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.StatusTramitacaoAdministrativo', verbose_name='Status')), + ('unidade_tramitacao_destino', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino')), + ('unidade_tramitacao_local', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='adm_tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local')), ], options={ 'verbose_name': 'Tramitação de Documento Administrativo', @@ -138,26 +130,31 @@ class Migration(migrations.Migration): migrations.AddField( model_name='protocolo', name='tipo_documento', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo de documento'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo de documento'), ), migrations.AddField( model_name='protocolo', name='tipo_materia', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.TipoMateriaLegislativa', verbose_name='Tipo Matéria'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.TipoMateriaLegislativa', verbose_name='Tipo Matéria'), + ), + migrations.AddField( + model_name='documentoadministrativo', + name='protocolo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.Protocolo', verbose_name='Protocolo'), ), migrations.AddField( model_name='documentoadministrativo', name='tipo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo Documento'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo Documento'), ), migrations.AddField( model_name='documentoacessorioadministrativo', name='documento', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.DocumentoAdministrativo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.DocumentoAdministrativo'), ), migrations.AddField( model_name='documentoacessorioadministrativo', name='tipo', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo'), ), ] diff --git a/sapl/protocoloadm/migrations/0002_delete_tipoinstituicao.py b/sapl/protocoloadm/migrations/0002_delete_tipoinstituicao.py deleted file mode 100644 index 064981161..000000000 --- a/sapl/protocoloadm/migrations/0002_delete_tipoinstituicao.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-05 17:42 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0001_initial'), - ] - - operations = [ - migrations.DeleteModel( - name='TipoInstituicao', - ), - ] diff --git a/sapl/protocoloadm/migrations/0003_auto_20161009_1222.py b/sapl/protocoloadm/migrations/0003_auto_20161009_1222.py deleted file mode 100644 index 4512ea548..000000000 --- a/sapl/protocoloadm/migrations/0003_auto_20161009_1222.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-09 15:22 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -def clear_field_autor_in_protocolo(apps, schema_editor): - Protocolo = apps.get_model("protocoloadm", "Protocolo") - for p in Protocolo.objects.all(): - p.autor = None - p.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0002_delete_tipoinstituicao'), - ] - - operations = [ - migrations.RunPython(clear_field_autor_in_protocolo), - migrations.AlterField( - model_name='documentoadministrativo', - name='autor', - field=models.ForeignKey( - blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.Autor'), - ), - migrations.AlterField( - model_name='protocolo', - name='autor', - field=models.ForeignKey( - blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.Autor'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0004_auto_20161023_1444.py b/sapl/protocoloadm/migrations/0004_auto_20161023_1444.py deleted file mode 100644 index 3900a64ff..000000000 --- a/sapl/protocoloadm/migrations/0004_auto_20161023_1444.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-23 14:44 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0003_auto_20161009_1222'), - ] - - operations = [ - migrations.AlterField( - model_name='tramitacaoadministrativo', - name='unidade_tramitacao_destino', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0005_auto_20161027_1741.py b/sapl/protocoloadm/migrations/0005_auto_20161027_1741.py deleted file mode 100644 index 891ff2a5e..000000000 --- a/sapl/protocoloadm/migrations/0005_auto_20161027_1741.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-27 17:41 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0004_auto_20161023_1444'), - ] - - operations = [ - migrations.AlterModelOptions( - name='protocolo', - options={'permissions': (('action_anular_protocolo', 'Permissão para Anular Protocolo'),), 'verbose_name': 'Protocolo', 'verbose_name_plural': 'Protocolos'}, - ), - ] diff --git a/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py b/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py deleted file mode 100644 index 4100f4157..000000000 --- a/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-03 17:21 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0005_auto_20161027_1741'), - ] - - operations = [ - migrations.AlterField( - model_name='protocolo', - name='tipo_protocolo', - field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Tipo de Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0007_auto_20161110_0910.py b/sapl/protocoloadm/migrations/0007_auto_20161110_0910.py deleted file mode 100644 index 79aa42f23..000000000 --- a/sapl/protocoloadm/migrations/0007_auto_20161110_0910.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-10 09:10 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0006_auto_20161103_1721'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='protocolo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0008_auto_20161216_1640.py b/sapl/protocoloadm/migrations/0008_auto_20161216_1640.py deleted file mode 100644 index 1fd7dcbdc..000000000 --- a/sapl/protocoloadm/migrations/0008_auto_20161216_1640.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2016-12-16 16:40 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0007_auto_20161110_0910'), - ] - - operations = [ - migrations.AlterModelOptions( - name='tipodocumentoadministrativo', - options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Documento Administrativo', 'verbose_name_plural': 'Tipos de Documento Administrativo'}, - ), - ] diff --git a/sapl/protocoloadm/migrations/0009_auto_20170102_0951.py b/sapl/protocoloadm/migrations/0009_auto_20170102_0951.py deleted file mode 100644 index 770a84c17..000000000 --- a/sapl/protocoloadm/migrations/0009_auto_20170102_0951.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-02 09:51 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0008_auto_20161216_1640'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='protocolo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[('', 'Selecione'), (2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0010_auto_20170123_1548.py b/sapl/protocoloadm/migrations/0010_auto_20170123_1548.py deleted file mode 100644 index 05dafb21c..000000000 --- a/sapl/protocoloadm/migrations/0010_auto_20170123_1548.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-23 15:48 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0009_auto_20170102_0951'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='protocolo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0010_auto_20170203_1019.py b/sapl/protocoloadm/migrations/0010_auto_20170203_1019.py deleted file mode 100644 index dadc43244..000000000 --- a/sapl/protocoloadm/migrations/0010_auto_20170203_1019.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-03 10:19 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0009_auto_20170102_0951'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'), - ), - migrations.AlterField( - model_name='protocolo', - name='ano', - field=models.PositiveSmallIntegerField(choices=[(2017, 2017), (2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0011_merge.py b/sapl/protocoloadm/migrations/0011_merge.py deleted file mode 100644 index 10ea183c3..000000000 --- a/sapl/protocoloadm/migrations/0011_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-03 16:34 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0010_auto_20170203_1019'), - ('protocoloadm', '0010_auto_20170123_1548'), - ] - - operations = [ - ] diff --git a/sapl/protocoloadm/migrations/0012_auto_20170315_1211.py b/sapl/protocoloadm/migrations/0012_auto_20170315_1211.py deleted file mode 100644 index 25ffbdf7b..000000000 --- a/sapl/protocoloadm/migrations/0012_auto_20170315_1211.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-15 12:11 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0011_merge'), - ] - - operations = [ - migrations.AddField( - model_name='documentoadministrativo', - name='protocolo', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.Protocolo'), - ), - migrations.AlterField( - model_name='documentoadministrativo', - name='observacao', - field=models.TextField(blank=True, null=True, verbose_name='Observação'), - ), - ] diff --git a/sapl/protocoloadm/migrations/0013_auto_20170320_1637.py b/sapl/protocoloadm/migrations/0013_auto_20170320_1637.py deleted file mode 100644 index f15b15de2..000000000 --- a/sapl/protocoloadm/migrations/0013_auto_20170320_1637.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-03-20 16:37 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0012_auto_20170315_1211'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='observacao', - field=models.TextField(blank=True, default='', verbose_name='Observação'), - preserve_default=False, - ), - ] diff --git a/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py b/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py deleted file mode 100644 index 661d7242b..000000000 --- a/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-03-21 11:30 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('protocoloadm', '0013_auto_20170320_1637'), - ] - - operations = [ - migrations.AlterField( - model_name='documentoadministrativo', - name='protocolo', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.Protocolo', verbose_name='Protocolo'), - ), - ] diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py index 551fdcc19..6294399f8 100644 --- a/sapl/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -64,17 +64,22 @@ class Protocolo(models.Model): tipo_processo = models.PositiveIntegerField() interessado = models.CharField( max_length=60, blank=True, verbose_name=_('Interessado')) - autor = models.ForeignKey(Autor, blank=True, null=True) + autor = models.ForeignKey(Autor, + blank=True, + null=True, + on_delete=models.PROTECT) assunto_ementa = models.TextField(blank=True) tipo_documento = models.ForeignKey( TipoDocumentoAdministrativo, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Tipo de documento')) tipo_materia = models.ForeignKey( TipoMateriaLegislativa, blank=True, null=True, + on_delete=models.PROTECT, verbose_name=_('Tipo Matéria')) numero_paginas = models.PositiveIntegerField( blank=True, null=True, verbose_name=_('Número de Páginas')) @@ -103,20 +108,24 @@ class Protocolo(models.Model): @reversion.register() class DocumentoAdministrativo(models.Model): tipo = models.ForeignKey( - TipoDocumentoAdministrativo, verbose_name=_('Tipo Documento')) + TipoDocumentoAdministrativo, on_delete=models.PROTECT, + verbose_name=_('Tipo Documento')) numero = models.PositiveIntegerField(verbose_name=_('Número')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'), choices=RANGE_ANOS) protocolo = models.ForeignKey( Protocolo, blank=True, - null=True, verbose_name=_('Protocolo')) + null=True, + on_delete=models.PROTECT, + verbose_name=_('Protocolo')) data = models.DateField(verbose_name=_('Data')) numero_protocolo = models.PositiveIntegerField( blank=True, null=True, verbose_name=_('Núm. Protocolo')) interessado = models.CharField( max_length=50, blank=True, verbose_name=_('Interessado')) - autor = models.ForeignKey(Autor, blank=True, null=True) + autor = models.ForeignKey(Autor, blank=True, null=True, + on_delete=models.PROTECT) dias_prazo = models.PositiveIntegerField( blank=True, null=True, verbose_name=_('Dias Prazo')) data_fim_prazo = models.DateField( @@ -169,9 +178,12 @@ class DocumentoAdministrativo(models.Model): @reversion.register() class DocumentoAcessorioAdministrativo(models.Model): - documento = models.ForeignKey(DocumentoAdministrativo) + documento = models.ForeignKey(DocumentoAdministrativo, + on_delete=models.PROTECT) tipo = models.ForeignKey( - TipoDocumentoAdministrativo, verbose_name=_('Tipo')) + TipoDocumentoAdministrativo, + on_delete=models.PROTECT, + verbose_name=_('Tipo')) nome = models.CharField(max_length=30, verbose_name=_('Nome')) arquivo = models.FileField( blank=True, @@ -244,19 +256,23 @@ class StatusTramitacaoAdministrativo(models.Model): class TramitacaoAdministrativo(models.Model): status = models.ForeignKey( StatusTramitacaoAdministrativo, + on_delete=models.PROTECT, verbose_name=_('Status')) - documento = models.ForeignKey(DocumentoAdministrativo) + documento = models.ForeignKey(DocumentoAdministrativo, + on_delete=models.PROTECT) data_tramitacao = models.DateField( verbose_name=_('Data Tramitação')) unidade_tramitacao_local = models.ForeignKey( UnidadeTramitacao, related_name='adm_tramitacoes_origem', + on_delete=models.PROTECT, verbose_name=_('Unidade Local')) data_encaminhamento = models.DateField( blank=True, null=True, verbose_name=_('Data Encaminhamento')) unidade_tramitacao_destino = models.ForeignKey( UnidadeTramitacao, related_name='adm_tramitacoes_destino', + on_delete=models.PROTECT, verbose_name=_('Unidade Destino')) texto = models.TextField( blank=True, verbose_name=_('Texto da Ação')) diff --git a/sapl/protocoloadm/urls.py b/sapl/protocoloadm/urls.py index 66dac0fdb..0c22d74d1 100644 --- a/sapl/protocoloadm/urls.py +++ b/sapl/protocoloadm/urls.py @@ -1,7 +1,6 @@ from django.conf.urls import include, url -from sapl.protocoloadm.views import (atualizar_numero_documento, - AnularProtocoloAdmView, +from sapl.protocoloadm.views import (AnularProtocoloAdmView, ComprovanteProtocoloView, CriarDocumentoProtocolo, DetailDocumentoAdministrativo, @@ -17,7 +16,9 @@ from sapl.protocoloadm.views import (atualizar_numero_documento, ProtocoloPesquisaView, StatusTramitacaoAdministrativoCrud, TipoDocumentoAdministrativoCrud, - TramitacaoAdmCrud, doc_texto_integral) + TramitacaoAdmCrud, + atualizar_numero_documento, + doc_texto_integral) from .apps import AppConfig diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 3e13920d4..9505f3bd9 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -341,7 +341,8 @@ class ProtocoloMostrarView(PermissionRequiredMixin, TemplateView): if protocolo.tipo_documento: context[ - 'documentos'] = protocolo.documentoadministrativo_set.all().order_by('-ano', '-numero') + 'documentos'] = protocolo.documentoadministrativo_set\ + .all().order_by('-ano', '-numero') context['protocolo'] = protocolo return context diff --git a/sapl/relatorios/migrations/__init__.py b/sapl/relatorios/migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py index 24796bb13..8890b9dcf 100644 --- a/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py +++ b/sapl/relatorios/templates/pdf_sessao_plenaria_gerar.py @@ -101,7 +101,7 @@ def inf_basicas(inf_basicas_dic): tmp += '\t\tInformações Básicas\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' tmp += '\t\tTipo da Sessão: ' + \ nom_sessao + '\n' @@ -120,7 +120,7 @@ def mesa(lst_mesa): tmp = '' tmp += '\t\tMesa Diretora\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' for mesa in lst_mesa: tmp += '\t\t' + \ @@ -136,7 +136,7 @@ def presenca(lst_presenca_sessao): tmp = '' tmp += '\t\tLista de Presença da Sessão\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' for presenca in lst_presenca_sessao: tmp += '\t\t' + \ @@ -154,10 +154,10 @@ def expedientes(lst_expedientes): tmp += '\t\t\n' tmp += '\t\t\t \n' tmp += '\t\t\n' - for expediente in lst_expedientes: - tmp += '\t\t' + \ + for idx, expediente in enumerate(lst_expedientes): + tmp += '\t\t' + '
' + \ expediente['nom_expediente'] + ':
\n' + \ - '' + \ + '' + \ expediente['txt_expediente'] + '\n' tmp += '\t\t\n' tmp += '\t\t\t \n' @@ -171,18 +171,22 @@ def expediente_materia(lst_expediente_materia): tmp = '' tmp += '\t\tMatérias do Expediente\n\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' tmp += '\n' tmp += 'MatériaEmentaResultado da Votação\n' for expediente_materia in lst_expediente_materia: - tmp += '' + str(expediente_materia['num_ordem']) + ' - ' + expediente_materia['id_materia'] + '\n' + 'Turno: ' + expediente_materia[ - 'des_turno'] + '\n' + 'Autor: ' + expediente_materia['nom_autor'] + '\n' + tmp += '' + str(expediente_materia['num_ordem']) + ' - ' + expediente_materia['id_materia'] + '\n' + 'Turno: ' + str(expediente_materia[ + 'des_turno']) + '\n' + 'Autor: ' + str(expediente_materia['nom_autor']) + '\n' txt_ementa = expediente_materia['txt_ementa'].replace('&', '&') tmp += '' + txt_ementa + '\n' tmp += '' + \ - str(expediente_materia['nom_resultado']) + '\n' + '' + \ - str(expediente_materia['votacao_observacao']) + '\n' + str(expediente_materia['nom_resultado']) + '
\n' + '' + if expediente_materia['votacao_observacao'] != txt_ementa: + tmp += str(expediente_materia['votacao_observacao']) + else: + tmp += ' ' + tmp += '\n' tmp += '\t\t\n' return tmp @@ -195,7 +199,7 @@ def oradores_expediente(lst_oradores_expediente): tmp = '' tmp += '\t\tOradores do Expediente\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' for orador_expediente in lst_oradores_expediente: tmp += '\t\t' + str(orador_expediente['num_ordem']) + ' - ' + orador_expediente[ @@ -210,7 +214,7 @@ def presenca_ordem_dia(lst_presenca_ordem_dia): tmp = '' tmp += '\t\tLista de Presença da Ordem do Dia\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' for presenca_ordem_dia in lst_presenca_ordem_dia: tmp += '\t\t' + \ @@ -226,7 +230,7 @@ def votacao(lst_votacao): tmp = '' tmp += 'Matérias da Ordem do Dia\n\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' tmp += '\n' tmp += 'MatériaEmentaResultado da Votação\n' @@ -236,8 +240,12 @@ def votacao(lst_votacao): txt_ementa = votacao['txt_ementa'].replace('&', '&') tmp += '' + txt_ementa + '\n' tmp += '' + \ - str(votacao['nom_resultado']) + '\n' + '' + \ - str(votacao['votacao_observacao']) + '\n' + str(votacao['nom_resultado']) + '
\n' + '' + if votacao['votacao_observacao'] != txt_ementa: + tmp += str(votacao['votacao_observacao']) + else: + tmp += ' ' + tmp += '\n' tmp += '\t\t\n' return tmp @@ -250,7 +258,7 @@ def oradores(lst_oradores): tmp = '' tmp += '\t\tOradores das Explicações Pessoais\n' tmp += '\t\t\n' - tmp += '\t\t\t \n' + tmp += '\t\t\t
\n' tmp += '\t\t
\n' for orador in lst_oradores: tmp += '\t\t' + \ @@ -290,6 +298,7 @@ def principal(cabecalho_dic, rodape_dic, imagem, sessao, inf_basicas_dic, lst_me tmp += oradores(lst_oradores) tmp += '\t\n' tmp += '\n' + tmp_pdf = parseString(tmp) return tmp_pdf # if hasattr(context.temp_folder,arquivoPdf): diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index cb402bd84..4b5416c2c 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -1,6 +1,8 @@ from datetime import datetime -from bs4 import BeautifulSoup +import re +import html + from django.core.exceptions import ObjectDoesNotExist from django.http import Http404, HttpResponse from django.utils.translation import ugettext_lazy as _ @@ -9,14 +11,14 @@ from sapl.base.models import Autor, CasaLegislativa from sapl.comissoes.models import Comissao from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao, Tramitacao, UnidadeTramitacao) -from sapl.parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao, - Parlamentar) +from sapl.parlamentares.models import CargoMesa, Filiacao, Parlamentar from sapl.protocoloadm.models import (DocumentoAdministrativo, Protocolo, TramitacaoAdministrativo) -from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, Orador, - OradorExpediente, OrdemDia, PresencaOrdemDia, - RegistroVotacao, SessaoPlenaria, - SessaoPlenariaPresenca, TipoExpediente) +from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, + IntegranteMesa, Orador, OradorExpediente, + OrdemDia, PresencaOrdemDia, RegistroVotacao, + SessaoPlenaria, SessaoPlenariaPresenca, + TipoExpediente) from sapl.settings import STATIC_ROOT from sapl.utils import UF @@ -485,8 +487,7 @@ def get_sessao_plenaria(sessao, casa): # Lista da composicao da mesa diretora lst_mesa = [] - for composicao in ComposicaoMesa.objects.filter( - sessao_legislativa=sessao.sessao_legislativa): + for composicao in IntegranteMesa.objects.filter(sessao_plenaria=sessao): for parlamentar in Parlamentar.objects.filter( id=composicao.parlamentar.id): for cargo in CargoMesa.objects.filter(id=composicao.cargo.id): @@ -520,15 +521,28 @@ def get_sessao_plenaria(sessao, casa): # Exibe os Expedientes lst_expedientes = [] - for tip_expediente in TipoExpediente.objects.all(): - for expediente in ExpedienteSessao.objects.filter( - sessao_plenaria=sessao, tipo=tip_expediente): - dic_expedientes = {} - dic_expedientes["nom_expediente"] = str(tip_expediente) - dic_expedientes["txt_expediente"] = ( - BeautifulSoup(expediente.conteudo).text) - if dic_expedientes: - lst_expedientes.append(dic_expedientes) + expedientes = ExpedienteSessao.objects.filter( + sessao_plenaria=sessao).order_by('tipo__nome') + + for e in expedientes: + + dic_expedientes = {} + dic_expedientes["nom_expediente"] = e.tipo.nome + conteudo = e.conteudo + + # unescape HTML codes + # https://github.com/interlegis/sapl/issues/1046 + conteudo = re.sub('style=".*?"', '', conteudo) + conteudo = html.unescape(conteudo) + + # escape special character '&' + # https://github.com/interlegis/sapl/issues/1009 + conteudo = conteudo.replace('&', '&') + + dic_expedientes["txt_expediente"] = conteudo + + if dic_expedientes: + lst_expedientes.append(dic_expedientes) # Lista das matérias do Expediente, incluindo o resultado das votacoes lst_expediente_materia = [] @@ -597,18 +611,16 @@ def get_sessao_plenaria(sessao, casa): dic_expediente_materia["nom_autor"] = 'Desconhecido' dic_expediente_materia["votacao_observacao"] = ' ' - if not expediente_materia.resultado: - resultado = RegistroVotacao.objects.filter( - tipo_resultado_votacao=expediente_materia.tipo_votacao) - - for i in resultado: + resultados = expediente_materia.registrovotacao_set.all() + if resultados: + for i in resultados: dic_expediente_materia["nom_resultado"] = ( i.tipo_resultado_votacao.nome) dic_expediente_materia["votacao_observacao"] = ( - expediente_materia.observacao) + i.observacao) else: dic_expediente_materia["nom_resultado"] = _("Matéria não votada") - dic_expediente_materia["votacao_observacao"] = _("Vazio") + dic_expediente_materia["votacao_observacao"] = _(" ") lst_expediente_materia.append(dic_expediente_materia) # Lista dos oradores do Expediente @@ -667,9 +679,9 @@ def get_sessao_plenaria(sessao, casa): materia=votacao.materia).first() if numeracao is not None: dic_votacao["des_numeracao"] = ( - str(numeracao.numero) + + str(numeracao.numero_materia) + '/' + - str(numeracao.ano)) + str(numeracao.ano_materia)) dic_votacao["des_turno"] = ' ' tramitacao = Tramitacao.objects.filter( @@ -713,16 +725,15 @@ def get_sessao_plenaria(sessao, casa): dic_votacao["nom_autor"] = 'Desconhecido' dic_votacao["votacao_observacao"] = ' ' - if not votacao.resultado: - resultado = RegistroVotacao.objects.filter( - tipo_resultado_votacao=votacao.tipo_votacao) - for i in resultado: + resultados = votacao.registrovotacao_set.all() + if resultados: + for i in resultados: dic_votacao["nom_resultado"] = i.tipo_resultado_votacao.nome if votacao.observacao: - dic_votacao["votacao_observacao"] = votacao.observacao + dic_votacao["votacao_observacao"] = i.observacao else: dic_votacao["nom_resultado"] = _("Matéria não votada") - dic_votacao["votacao_observacao"] = _("Vazio") + dic_votacao["votacao_observacao"] = _(" ") lst_votacao.append(dic_votacao) # Lista dos oradores nas Explicações Pessoais @@ -1089,11 +1100,11 @@ def get_pauta_sessao(sessao, casa): dic_votacao["ordem_observacao"] = votacao.observacao dic_votacao["des_numeracao"] = ' ' - numeracao = Numeracao.objects.filter(materia=materia) - # if numeracao is not None: - # numeracao = numeracao.first() - # dic_votacao["des_numeracao"] = str( - # numeracao.numero) + '/' + str(numeracao.ano) +# numeracao = Numeracao.objects.filter(materia=materia) +# if numeracao is not None: +# numeracao = numeracao.first() +# dic_votacao["des_numeracao"] = str( +# numeracao.numero_materia) + '/' + str(numeracao.ano_materia) dic_votacao["nom_autor"] = ' ' autoria = Autoria.objects.filter( diff --git a/sapl/rules/map_rules.py b/sapl/rules/map_rules.py index 906592fd0..05d869fd8 100644 --- a/sapl/rules/map_rules.py +++ b/sapl/rules/map_rules.py @@ -197,6 +197,8 @@ rules_group_geral = { (base.CasaLegislativa, __listdetailchange__), (base.ProblemaMigracao, []), + (base.Argumento, []), + (base.Constraint, []), (base.TipoAutor, __base__), (base.Autor, __base__), diff --git a/sapl/rules/migrations/__init__.py b/sapl/rules/migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/sapl/rules/tests/test_rules.py b/sapl/rules/tests/test_rules.py index 3662477b9..6fc7eb3fe 100644 --- a/sapl/rules/tests/test_rules.py +++ b/sapl/rules/tests/test_rules.py @@ -6,7 +6,8 @@ from django.contrib.contenttypes.models import ContentType from django.utils import six from django.utils.translation import ugettext_lazy as _ -from sapl.base.models import CasaLegislativa, ProblemaMigracao +from sapl.base.models import (CasaLegislativa, ProblemaMigracao, Argumento, + Constraint) from sapl.compilacao.models import (PerfilEstruturalTextoArticulado, TipoDispositivo, TipoDispositivoRelationship) @@ -56,11 +57,15 @@ def test_models_in_rules_patterns(model_item): __fp__in__test_permission_of_models_in_rules_patterns = { map_rules.RP_ADD: [CasaLegislativa, ProblemaMigracao, + Argumento, + Constraint, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], map_rules.RP_CHANGE: [ProblemaMigracao, + Argumento, + Constraint, AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, @@ -68,17 +73,23 @@ __fp__in__test_permission_of_models_in_rules_patterns = { map_rules.RP_DELETE: [CasaLegislativa, ProblemaMigracao, + Argumento, + Constraint, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], map_rules.RP_LIST: [ProblemaMigracao, + Argumento, + Constraint, AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, PerfilEstruturalTextoArticulado], map_rules.RP_DETAIL: [ProblemaMigracao, + Argumento, + Constraint, AcompanhamentoMateria, TipoDispositivo, TipoDispositivoRelationship, diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index ded56d4cd..4303dabcc 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -83,11 +83,11 @@ class ExpedienteMateriaForm(ModelForm): def clean_numero_ordem(self): sessao = self.instance.sessao_plenaria - ex = ExpedienteMateria.objects.filter( + numero_ordem_exists = ExpedienteMateria.objects.filter( sessao_plenaria=sessao, - numero_ordem=self.cleaned_data['numero_ordem']).count() + numero_ordem=self.cleaned_data['numero_ordem']).exists() - if ex >= 1: + if numero_ordem_exists: msg = _('Esse número de ordem já existe.') raise ValidationError(msg) @@ -139,6 +139,22 @@ class OrdemDiaForm(ExpedienteMateriaForm): def clean_data_ordem(self): return self.instance.sessao_plenaria.data_inicio + + def clean_numero_ordem(self): + sessao = self.instance.sessao_plenaria + + numero_ordem_exists = OrdemDia.objects.filter( + sessao_plenaria=sessao, + numero_ordem=self.cleaned_data[ + 'numero_ordem']).exists() + + if numero_ordem_exists: + msg = _('Esse número de ordem já existe.') + raise ValidationError(msg) + + return self.cleaned_data['numero_ordem'] + + def clean(self): cleaned_data = self.cleaned_data sessao = self.instance.sessao_plenaria diff --git a/sapl/sessao/legacy.yaml b/sapl/sessao/legacy.yaml index 6e2cc2428..90188a76c 100644 --- a/sapl/sessao/legacy.yaml +++ b/sapl/sessao/legacy.yaml @@ -65,7 +65,6 @@ RegistroVotacao: numero_votos_nao: num_votos_nao numero_votos_sim: num_votos_sim observacao: txt_observacao - ordem: cod_ordem tipo_resultado_votacao: tip_resultado_votacao VotoParlamentar (RegistroVotacaoParlamentar): diff --git a/sapl/sessao/migrations/0001_initial.py b/sapl/sessao/migrations/0001_initial.py index fe4d09a66..1b23dc744 100644 --- a/sapl/sessao/migrations/0001_initial.py +++ b/sapl/sessao/migrations/0001_initial.py @@ -1,256 +1,336 @@ # -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-03-25 11:14 from __future__ import unicode_literals +from django.conf import settings from django.db import migrations, models +import django.db.models.deletion +import sapl.sessao.models +import sapl.utils class Migration(migrations.Migration): + initial = True + dependencies = [ ('parlamentares', '0001_initial'), ('materia', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ + migrations.CreateModel( + name='Bancada', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(max_length=80, verbose_name='Nome da Bancada')), + ('data_criacao', models.DateField(blank=True, null=True, verbose_name='Data Criação')), + ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data Extinção')), + ('descricao', models.TextField(blank=True, verbose_name='Descrição')), + ('legislatura', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Legislatura', verbose_name='Legislatura')), + ('partido', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Partido', verbose_name='Partido')), + ], + options={ + 'ordering': ('-legislatura__numero',), + 'verbose_name': 'Bancada', + 'verbose_name_plural': 'Bancadas', + }, + ), + migrations.CreateModel( + name='Bloco', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome', models.CharField(max_length=80, verbose_name='Nome do Bloco')), + ('data_criacao', models.DateField(blank=True, null=True, verbose_name='Data Criação')), + ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data Dissolução')), + ('descricao', models.TextField(blank=True, verbose_name='Descrição')), + ('partidos', models.ManyToManyField(blank=True, to='parlamentares.Partido', verbose_name='Bancadas')), + ], + options={ + 'verbose_name': 'Bloco', + 'verbose_name_plural': 'Blocos', + }, + ), + migrations.CreateModel( + name='CargoBancada', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nome_cargo', models.CharField(max_length=80, verbose_name='Cargo de Bancada')), + ('cargo_unico', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Cargo Único ?')), + ], + options={ + 'verbose_name': 'Cargo de Bancada', + 'verbose_name_plural': 'Cargos de Bancada', + }, + ), migrations.CreateModel( name='ExpedienteMateria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_ordem', models.DateField(verbose_name='Data da Sessão')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Ementa')), - ('numero_ordem', models.IntegerField(verbose_name='Nº Ordem')), - ('resultado', models.TextField(blank=True, null=True)), - ('tipo_votacao', models.IntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), + ('observacao', models.TextField(blank=True, verbose_name='Ementa')), + ('numero_ordem', models.PositiveIntegerField(verbose_name='Nº Ordem')), + ('resultado', models.TextField(blank=True, verbose_name='Resultado')), + ('tipo_votacao', models.PositiveIntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação')), + ('votacao_aberta', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Votação iniciada?')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa', verbose_name='Matéria')), ], options={ - 'verbose_name_plural': 'Matérias do Expediente', + 'ordering': ['numero_ordem'], 'verbose_name': 'Matéria do Expediente', + 'verbose_name_plural': 'Matérias do Expediente', }, ), migrations.CreateModel( name='ExpedienteSessao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('conteudo', models.TextField(blank=True, null=True, verbose_name='Conteúdo do expediente')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('conteudo', models.TextField(blank=True, verbose_name='Conteúdo do expediente')), ], options={ - 'verbose_name_plural': 'Expedientes de Sessão Plenaria', 'verbose_name': 'Expediente de Sessão Plenaria', + 'verbose_name_plural': 'Expedientes de Sessão Plenaria', }, ), migrations.CreateModel( name='IntegranteMesa', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('cargo', models.ForeignKey(to='parlamentares.CargoMesa')), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cargo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.CargoMesa')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), ], options={ - 'verbose_name_plural': 'Participações em Mesas de Sessão Plenaria', 'verbose_name': 'Participação em Mesa de Sessão Plenaria', + 'verbose_name_plural': 'Participações em Mesas de Sessão Plenaria', }, ), migrations.CreateModel( name='Orador', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero_ordem', models.IntegerField(verbose_name='Ordem de pronunciamento')), - ('url_discurso', models.CharField(blank=True, max_length=150, null=True, verbose_name='URL Vídeo')), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar', verbose_name='Parlamentar')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero_ordem', models.PositiveIntegerField(verbose_name='Ordem de pronunciamento')), + ('url_discurso', models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo')), + ('observacao', models.CharField(blank=True, max_length=150, verbose_name='Observação')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar', verbose_name='Parlamentar')), ], options={ - 'verbose_name_plural': 'Oradores das Explicações Pessoais', 'verbose_name': 'Orador das Explicações Pessoais', + 'verbose_name_plural': 'Oradores das Explicações Pessoais', }, ), migrations.CreateModel( name='OradorExpediente', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero_ordem', models.IntegerField(verbose_name='Ordem de pronunciamento')), - ('url_discurso', models.CharField(blank=True, max_length=150, null=True, verbose_name='URL Vídeo')), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar', verbose_name='Parlamentar')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero_ordem', models.PositiveIntegerField(verbose_name='Ordem de pronunciamento')), + ('url_discurso', models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo')), + ('observacao', models.CharField(blank=True, max_length=150, verbose_name='Observação')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar', verbose_name='Parlamentar')), ], options={ - 'verbose_name_plural': 'Oradores do Expediente', 'verbose_name': 'Orador do Expediente', + 'verbose_name_plural': 'Oradores do Expediente', }, ), migrations.CreateModel( name='OrdemDia', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_ordem', models.DateField(verbose_name='Data da Sessão')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Ementa')), - ('numero_ordem', models.IntegerField(verbose_name='Nº Ordem')), - ('resultado', models.TextField(blank=True, null=True)), - ('tipo_votacao', models.IntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), + ('observacao', models.TextField(blank=True, verbose_name='Ementa')), + ('numero_ordem', models.PositiveIntegerField(verbose_name='Nº Ordem')), + ('resultado', models.TextField(blank=True, verbose_name='Resultado')), + ('tipo_votacao', models.PositiveIntegerField(choices=[(1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação')), + ('votacao_aberta', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Votação iniciada?')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa', verbose_name='Matéria')), ], options={ - 'verbose_name_plural': 'Matérias da Ordem do Dia', + 'ordering': ['numero_ordem'], 'verbose_name': 'Matéria da Ordem do Dia', + 'verbose_name_plural': 'Matérias da Ordem do Dia', }, ), migrations.CreateModel( name='PresencaOrdemDia', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('data_ordem', models.DateField()), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), ], options={ - 'verbose_name_plural': 'Presenças da Ordem do Dia', + 'ordering': ['parlamentar__nome_parlamentar'], 'verbose_name': 'Presença da Ordem do Dia', + 'verbose_name_plural': 'Presenças da Ordem do Dia', }, ), migrations.CreateModel( name='RegistroVotacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('numero_votos_sim', models.IntegerField(verbose_name='Sim')), - ('numero_votos_nao', models.IntegerField(verbose_name='Não')), - ('numero_abstencoes', models.IntegerField(verbose_name='Abstenções')), - ('observacao', models.TextField(blank=True, null=True, verbose_name='Observações')), - ('materia', models.ForeignKey(to='materia.MateriaLegislativa')), - ('ordem', models.ForeignKey(to='sessao.OrdemDia')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('numero_votos_sim', models.PositiveIntegerField(verbose_name='Sim')), + ('numero_votos_nao', models.PositiveIntegerField(verbose_name='Não')), + ('numero_abstencoes', models.PositiveIntegerField(verbose_name='Abstenções')), + ('observacao', models.TextField(blank=True, verbose_name='Observações')), + ('expediente', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='sessao.ExpedienteMateria')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), + ('ordem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='sessao.OrdemDia')), ], options={ - 'verbose_name_plural': 'Votações', 'verbose_name': 'Votação', + 'verbose_name_plural': 'Votações', }, ), migrations.CreateModel( name='SessaoPlenaria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), - ('cod_andamento_sessao', models.IntegerField(blank=True, null=True)), - ('tipo_expediente', models.CharField(max_length=10)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('cod_andamento_sessao', models.PositiveIntegerField(blank=True, null=True)), ('data_inicio', models.DateField(verbose_name='Abertura')), - ('dia', models.CharField(max_length=15)), - ('hora_inicio', models.CharField(max_length=5, verbose_name='Horário')), - ('hora_fim', models.CharField(blank=True, max_length=5, null=True, verbose_name='Horário')), - ('numero', models.IntegerField(verbose_name='Número')), + ('hora_inicio', models.CharField(max_length=5, verbose_name='Horário (hh:mm)')), + ('hora_fim', models.CharField(blank=True, max_length=5, verbose_name='Horário (hh:mm)')), + ('numero', models.PositiveIntegerField(verbose_name='Número')), ('data_fim', models.DateField(blank=True, null=True, verbose_name='Encerramento')), - ('url_audio', models.CharField(blank=True, max_length=150, null=True, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)')), - ('url_video', models.CharField(blank=True, max_length=150, null=True, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)')), - ('legislatura', models.ForeignKey(to='parlamentares.Legislatura', verbose_name='Legislatura')), - ('sessao_legislativa', models.ForeignKey(to='parlamentares.SessaoLegislativa', verbose_name='Sessão Legislativa')), + ('url_audio', models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)')), + ('url_video', models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)')), + ('upload_pauta', models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Sessão')), + ('upload_ata', models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Sessão')), + ('upload_anexo', models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo da Sessão')), + ('iniciada', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Sessão iniciada?')), + ('finalizada', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Sessão finalizada?')), + ('legislatura', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Legislatura', verbose_name='Legislatura')), + ('sessao_legislativa', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.SessaoLegislativa', verbose_name='Sessão Legislativa')), ], options={ - 'verbose_name_plural': 'Sessões Plenárias', 'verbose_name': 'Sessão Plenária', + 'verbose_name_plural': 'Sessões Plenárias', }, ), migrations.CreateModel( name='SessaoPlenariaPresenca', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_sessao', models.DateField(blank=True, null=True)), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar')), - ('sessao_plen', models.ForeignKey(to='sessao.SessaoPlenaria')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), + ('sessao_plenaria', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria')), ], options={ - 'verbose_name_plural': 'Presenças em Sessões Plenárias', + 'ordering': ['parlamentar__nome_parlamentar'], 'verbose_name': 'Presença em Sessão Plenária', + 'verbose_name_plural': 'Presenças em Sessões Plenárias', }, ), migrations.CreateModel( name='TipoExpediente', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=100, verbose_name='Tipo')), ], options={ - 'verbose_name_plural': 'Tipos de Expediente', 'verbose_name': 'Tipo de Expediente', + 'verbose_name_plural': 'Tipos de Expediente', }, ), migrations.CreateModel( name='TipoResultadoVotacao', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=100, verbose_name='Tipo')), ], options={ - 'verbose_name_plural': 'Tipos de Resultado de Votação', 'verbose_name': 'Tipo de Resultado de Votação', + 'verbose_name_plural': 'Tipos de Resultado de Votação', }, ), migrations.CreateModel( name='TipoSessaoPlenaria', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=30, verbose_name='Tipo')), - ('quorum_minimo', models.IntegerField(verbose_name='Quórum mínimo')), + ('quorum_minimo', models.PositiveIntegerField(verbose_name='Quórum mínimo')), ], options={ - 'verbose_name_plural': 'Tipos de Sessão Plenária', 'verbose_name': 'Tipo de Sessão Plenária', + 'verbose_name_plural': 'Tipos de Sessão Plenária', + }, + ), + migrations.CreateModel( + name='VotoNominal', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('voto', models.CharField(max_length=10, verbose_name='Voto')), + ('ip', models.CharField(max_length=30, verbose_name='IP')), + ('data_hora', models.DateTimeField(auto_now_add=True, verbose_name='Data/Hora')), + ('materia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='materia.MateriaLegislativa')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), + ('sessao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'Registro do Voto do Parlamentar', + 'verbose_name_plural': 'Registros dos Votos dos Parlamentares', }, ), migrations.CreateModel( name='VotoParlamentar', fields=[ - ('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('voto', models.CharField(max_length=10)), - ('parlamentar', models.ForeignKey(to='parlamentares.Parlamentar')), - ('votacao', models.ForeignKey(to='sessao.RegistroVotacao')), + ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='parlamentares.Parlamentar')), + ('votacao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.RegistroVotacao')), ], options={ - 'verbose_name_plural': 'Registros de Votações de Parlamentares', 'verbose_name': 'Registro de Votação de Parlamentar', + 'verbose_name_plural': 'Registros de Votações de Parlamentares', }, ), migrations.AddField( model_name='sessaoplenaria', name='tipo', - field=models.ForeignKey(to='sessao.TipoSessaoPlenaria', verbose_name='Tipo'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.TipoSessaoPlenaria', verbose_name='Tipo'), ), migrations.AddField( model_name='registrovotacao', name='tipo_resultado_votacao', - field=models.ForeignKey(to='sessao.TipoResultadoVotacao', verbose_name='Resultado da Votação'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.TipoResultadoVotacao', verbose_name='Resultado da Votação'), ), migrations.AddField( model_name='presencaordemdia', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='ordemdia', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='oradorexpediente', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='orador', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='integrantemesa', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='expedientesessao', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), migrations.AddField( model_name='expedientesessao', name='tipo', - field=models.ForeignKey(to='sessao.TipoExpediente'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.TipoExpediente'), ), migrations.AddField( model_name='expedientemateria', name='sessao_plenaria', - field=models.ForeignKey(to='sessao.SessaoPlenaria'), + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='sessao.SessaoPlenaria'), ), ] diff --git a/sapl/sessao/migrations/0002_auto_20150729_1450.py b/sapl/sessao/migrations/0002_auto_20150729_1450.py deleted file mode 100644 index 6212c5f3f..000000000 --- a/sapl/sessao/migrations/0002_auto_20150729_1450.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='sessaoplenaria', - name='dia', - ), - migrations.AddField( - model_name='sessaoplenaria', - name='finalizada', - field=models.NullBooleanField(verbose_name='Sessão finalizada?', choices=[(True, 'Sim'), (False, 'Não')]), - ), - migrations.AddField( - model_name='sessaoplenaria', - name='iniciada', - field=models.NullBooleanField(verbose_name='Sessão iniciada?', choices=[(True, 'Sim'), (False, 'Não')]), - ), - migrations.AddField( - model_name='sessaoplenaria', - name='upload_ata', - field=models.FileField(verbose_name='Ata da Sessão', null=True, upload_to='', blank=True), - ), - migrations.AddField( - model_name='sessaoplenaria', - name='upload_pauta', - field=models.FileField(verbose_name='Pauta da Sessão', null=True, upload_to='', blank=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='hora_fim', - field=models.CharField(verbose_name='Horário (hh:mm)', null=True, max_length=5, blank=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='hora_inicio', - field=models.CharField(verbose_name='Horário (hh:mm)', max_length=5), - ), - ] diff --git a/sapl/compilacao/migrations/0063_tipotextoarticulado_publicacao_func.py b/sapl/sessao/migrations/0002_sessaoplenaria_interativa.py similarity index 54% rename from sapl/compilacao/migrations/0063_tipotextoarticulado_publicacao_func.py rename to sapl/sessao/migrations/0002_sessaoplenaria_interativa.py index 53dac62fc..9a868ce58 100644 --- a/sapl/compilacao/migrations/0063_tipotextoarticulado_publicacao_func.py +++ b/sapl/sessao/migrations/0002_sessaoplenaria_interativa.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-11-03 11:06 +# Generated by Django 1.9.11 on 2017-05-10 15:49 from __future__ import unicode_literals from django.db import migrations, models @@ -8,13 +8,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('compilacao', '0062_auto_20161101_1221'), + ('sessao', '0001_initial'), ] operations = [ migrations.AddField( - model_name='tipotextoarticulado', - name='publicacao_func', - field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Histórico de Publicação'), + model_name='sessaoplenaria', + name='interativa', + field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Sessão interativa'), ), ] diff --git a/sapl/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py b/sapl/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py deleted file mode 100644 index 71e92b3d2..000000000 --- a/sapl/sessao/migrations/0003_remove_sessaoplenaria_tipo_expediente.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0002_auto_20150729_1450'), - ] - - operations = [ - migrations.RemoveField( - model_name='sessaoplenaria', - name='tipo_expediente', - ), - ] diff --git a/sapl/sessao/migrations/0004_auto_20150806_1614.py b/sapl/sessao/migrations/0004_auto_20150806_1614.py deleted file mode 100644 index 7785125c8..000000000 --- a/sapl/sessao/migrations/0004_auto_20150806_1614.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - -import sapl.sessao.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0003_remove_sessaoplenaria_tipo_expediente'), - ] - - operations = [ - migrations.AlterField( - model_name='expedientemateria', - name='numero_ordem', - field=models.PositiveIntegerField(verbose_name='Nº Ordem'), - ), - migrations.AlterField( - model_name='expedientemateria', - name='tipo_votacao', - field=models.PositiveIntegerField(choices=[( - 1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), - ), - migrations.AlterField( - model_name='orador', - name='numero_ordem', - field=models.PositiveIntegerField( - verbose_name='Ordem de pronunciamento'), - ), - migrations.AlterField( - model_name='oradorexpediente', - name='numero_ordem', - field=models.PositiveIntegerField( - verbose_name='Ordem de pronunciamento'), - ), - migrations.AlterField( - model_name='ordemdia', - name='numero_ordem', - field=models.PositiveIntegerField(verbose_name='Nº Ordem'), - ), - migrations.AlterField( - model_name='ordemdia', - name='tipo_votacao', - field=models.PositiveIntegerField(choices=[( - 1, 'Simbólica'), (2, 'Nominal'), (3, 'Secreta')], verbose_name='Tipo de votação'), - ), - migrations.AlterField( - model_name='registrovotacao', - name='numero_abstencoes', - field=models.PositiveIntegerField(verbose_name='Abstenções'), - ), - migrations.AlterField( - model_name='registrovotacao', - name='numero_votos_nao', - field=models.PositiveIntegerField(verbose_name='Não'), - ), - migrations.AlterField( - model_name='registrovotacao', - name='numero_votos_sim', - field=models.PositiveIntegerField(verbose_name='Sim'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='cod_andamento_sessao', - field=models.PositiveIntegerField(blank=True, null=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='numero', - field=models.PositiveIntegerField(verbose_name='Número'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='upload_ata', - field=models.FileField( - blank=True, upload_to=sapl.sessao.models.ata_upload_path, null=True, verbose_name='Ata da Sessão'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='upload_pauta', - field=models.FileField( - blank=True, upload_to=sapl.sessao.models.pauta_upload_path, null=True, verbose_name='Pauta da Sessão'), - ), - migrations.AlterField( - model_name='tiposessaoplenaria', - name='quorum_minimo', - field=models.PositiveIntegerField(verbose_name='Quórum mínimo'), - ), - ] diff --git a/sapl/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py b/sapl/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py deleted file mode 100644 index 8d73c542e..000000000 --- a/sapl/sessao/migrations/0005_remove_presencaordemdia_data_ordem.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0004_auto_20150806_1614'), - ] - - operations = [ - migrations.RemoveField( - model_name='presencaordemdia', - name='data_ordem', - ), - ] diff --git a/sapl/sessao/migrations/0006_auto_20150929_1425.py b/sapl/sessao/migrations/0006_auto_20150929_1425.py deleted file mode 100644 index 4b438a29f..000000000 --- a/sapl/sessao/migrations/0006_auto_20150929_1425.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0005_remove_presencaordemdia_data_ordem'), - ] - - operations = [ - migrations.AlterModelOptions( - name='expedientemateria', - options={'ordering': ['numero_ordem'], 'verbose_name': 'Matéria do Expediente', 'verbose_name_plural': 'Matérias do Expediente'}, - ), - migrations.AlterModelOptions( - name='ordemdia', - options={'ordering': ['numero_ordem'], 'verbose_name': 'Matéria da Ordem do Dia', 'verbose_name_plural': 'Matérias da Ordem do Dia'}, - ), - migrations.AlterModelOptions( - name='presencaordemdia', - options={'ordering': ['parlamentar__nome_parlamentar'], 'verbose_name': 'Presença da Ordem do Dia', 'verbose_name_plural': 'Presenças da Ordem do Dia'}, - ), - migrations.AlterModelOptions( - name='sessaoplenariapresenca', - options={'ordering': ['parlamentar__nome_parlamentar'], 'verbose_name': 'Presença em Sessão Plenária', 'verbose_name_plural': 'Presenças em Sessões Plenárias'}, - ), - ] diff --git a/sapl/sessao/migrations/0007_auto_20150929_1426.py b/sapl/sessao/migrations/0007_auto_20150929_1426.py deleted file mode 100644 index d97091ecb..000000000 --- a/sapl/sessao/migrations/0007_auto_20150929_1426.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0006_auto_20150929_1425'), - ] - - operations = [ - migrations.RenameField( - model_name='sessaoplenariapresenca', - old_name='sessao_plen', - new_name='sessao_plenaria', - ), - ] diff --git a/sapl/sessao/migrations/0008_auto_20151005_0814.py b/sapl/sessao/migrations/0008_auto_20151005_0814.py deleted file mode 100644 index 95cc5532a..000000000 --- a/sapl/sessao/migrations/0008_auto_20151005_0814.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0007_auto_20150929_1426'), - ] - - operations = [ - migrations.AddField( - model_name='expedientemateria', - name='votacao_iniciada', - field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Votação iniciada?'), - ), - migrations.AddField( - model_name='ordemdia', - name='votacao_iniciada', - field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Votação iniciada?'), - ), - ] diff --git a/sapl/sessao/migrations/0009_auto_20151005_0934.py b/sapl/sessao/migrations/0009_auto_20151005_0934.py deleted file mode 100644 index b4d6819d6..000000000 --- a/sapl/sessao/migrations/0009_auto_20151005_0934.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0008_auto_20151005_0814'), - ] - - operations = [ - migrations.RenameField( - model_name='expedientemateria', - old_name='votacao_iniciada', - new_name='votacao_aberta', - ), - migrations.RenameField( - model_name='ordemdia', - old_name='votacao_iniciada', - new_name='votacao_aberta', - ), - ] diff --git a/sapl/sessao/migrations/0010_acompanharmateria.py b/sapl/sessao/migrations/0010_acompanharmateria.py deleted file mode 100644 index 30e03f620..000000000 --- a/sapl/sessao/migrations/0010_acompanharmateria.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -from django.conf import settings - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0013_remove_tramitacao_ultima'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('sessao', '0009_auto_20151005_0934'), - ] - - operations = [ - migrations.CreateModel( - name='AcompanharMateria', - fields=[ - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)), - ('email', models.CharField(verbose_name='Endereço de email', max_length=50)), - ('data_cadastro', models.DateField(auto_now_add=True)), - ('materia_cadastrada', models.ForeignKey(to='materia.MateriaLegislativa')), - ('usuario', models.ForeignKey(to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/sapl/sessao/migrations/0011_auto_20160113_1239.py b/sapl/sessao/migrations/0011_auto_20160113_1239.py deleted file mode 100644 index b740ae875..000000000 --- a/sapl/sessao/migrations/0011_auto_20160113_1239.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0010_acompanharmateria'), - ] - - operations = [ - migrations.AlterField( - model_name='acompanharmateria', - name='usuario', - field=models.CharField(max_length=50), - ), - ] diff --git a/sapl/sessao/migrations/0012_auto_20160120_1237.py b/sapl/sessao/migrations/0012_auto_20160120_1237.py deleted file mode 100644 index a72740276..000000000 --- a/sapl/sessao/migrations/0012_auto_20160120_1237.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0011_auto_20160113_1239'), - ] - - operations = [ - migrations.AddField( - model_name='registrovotacao', - name='expediente', - field=models.ForeignKey(blank=True, null=True, to='sessao.ExpedienteMateria'), - ), - migrations.AlterField( - model_name='registrovotacao', - name='ordem', - field=models.ForeignKey(blank=True, null=True, to='sessao.OrdemDia'), - ), - ] diff --git a/sapl/sessao/migrations/0013_auto_20160216_1015.py b/sapl/sessao/migrations/0013_auto_20160216_1015.py deleted file mode 100644 index 60d75bc31..000000000 --- a/sapl/sessao/migrations/0013_auto_20160216_1015.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0012_auto_20160120_1237'), - ] - - operations = [ - migrations.AlterField( - model_name='expedientemateria', - name='observacao', - field=models.TextField(verbose_name='Ementa', blank=True), - ), - migrations.AlterField( - model_name='expedientemateria', - name='resultado', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='expedientesessao', - name='conteudo', - field=models.TextField(verbose_name='Conteúdo do expediente', blank=True), - ), - migrations.AlterField( - model_name='orador', - name='url_discurso', - field=models.CharField(verbose_name='URL Vídeo', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='oradorexpediente', - name='url_discurso', - field=models.CharField(verbose_name='URL Vídeo', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='ordemdia', - name='observacao', - field=models.TextField(verbose_name='Ementa', blank=True), - ), - migrations.AlterField( - model_name='ordemdia', - name='resultado', - field=models.TextField(blank=True), - ), - migrations.AlterField( - model_name='registrovotacao', - name='observacao', - field=models.TextField(verbose_name='Observações', blank=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='hora_fim', - field=models.CharField(verbose_name='Horário (hh:mm)', max_length=5, blank=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='url_audio', - field=models.CharField(verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)', max_length=150, blank=True), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='url_video', - field=models.CharField(verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)', max_length=150, blank=True), - ), - ] diff --git a/sapl/sessao/migrations/0014_auto_20160223_0813.py b/sapl/sessao/migrations/0014_auto_20160223_0813.py deleted file mode 100644 index fa1fc08f2..000000000 --- a/sapl/sessao/migrations/0014_auto_20160223_0813.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0013_auto_20160216_1015'), - ] - - operations = [ - migrations.RemoveField( - model_name='acompanharmateria', - name='materia_cadastrada', - ), - migrations.DeleteModel( - name='AcompanharMateria', - ), - ] diff --git a/sapl/sessao/migrations/0015_auto_20160307_0918.py b/sapl/sessao/migrations/0015_auto_20160307_0918.py deleted file mode 100644 index adc382bc7..000000000 --- a/sapl/sessao/migrations/0015_auto_20160307_0918.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-03-07 12:18 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0014_auto_20160223_0813'), - ] - - operations = [ - migrations.AlterField( - model_name='orador', - name='url_discurso', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo'), - ), - migrations.AlterField( - model_name='oradorexpediente', - name='url_discurso', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='url_audio', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='url_video', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)'), - ), - ] diff --git a/sapl/sessao/migrations/0016_auto_20160404_1409.py b/sapl/sessao/migrations/0016_auto_20160404_1409.py deleted file mode 100644 index 88aa6a954..000000000 --- a/sapl/sessao/migrations/0016_auto_20160404_1409.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-04-04 17:09 -from __future__ import unicode_literals - -from django.db import migrations, models - -import sapl.sessao.models -import sapl.utils - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0015_auto_20160307_0918'), - ] - - operations = [ - migrations.AlterField( - model_name='sessaoplenaria', - name='upload_ata', - field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.ata_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Sessão'), - ), - migrations.AlterField( - model_name='sessaoplenaria', - name='upload_pauta', - field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.pauta_upload_path, validators=[ - sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Sessão'), - ), - ] diff --git a/sapl/sessao/migrations/0017_bancada.py b/sapl/sessao/migrations/0017_bancada.py deleted file mode 100644 index 25770a220..000000000 --- a/sapl/sessao/migrations/0017_bancada.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-17 17:26 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0018_auto_20160510_0943'), - ('sessao', '0016_auto_20160404_1409'), - ] - - operations = [ - migrations.CreateModel( - name='Bancada', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('nome', models.CharField(max_length=80, verbose_name='Nome da Bancada, Bloco, Frente ou Grupo')), - ('data_criacao', models.DateField(blank=True, verbose_name='Data Criação')), - ('data_extincao', models.DateField(blank=True, verbose_name='Data Extinção')), - ('descricao', models.TextField(blank=True, verbose_name='Descrição')), - ('legislatura', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Legislatura', verbose_name='Legislatura')), - ('partido', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Partido', verbose_name='Partido')), - ], - options={ - 'verbose_name_plural': 'Bancadas', - 'verbose_name': 'Bancada', - }, - ), - ] diff --git a/sapl/sessao/migrations/0018_auto_20160517_1435.py b/sapl/sessao/migrations/0018_auto_20160517_1435.py deleted file mode 100644 index 849ccad31..000000000 --- a/sapl/sessao/migrations/0018_auto_20160517_1435.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-17 17:35 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0017_bancada'), - ] - - operations = [ - migrations.AlterField( - model_name='bancada', - name='data_criacao', - field=models.DateField(blank=True, null=True, verbose_name='Data Criação'), - ), - migrations.AlterField( - model_name='bancada', - name='data_extincao', - field=models.DateField(blank=True, null=True, verbose_name='Data Extinção'), - ), - migrations.AlterField( - model_name='bancada', - name='partido', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Partido', verbose_name='Partido'), - ), - ] diff --git a/sapl/sessao/migrations/0019_cargobancada.py b/sapl/sessao/migrations/0019_cargobancada.py deleted file mode 100644 index 44a4db58a..000000000 --- a/sapl/sessao/migrations/0019_cargobancada.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-17 17:42 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0018_auto_20160517_1435'), - ] - - operations = [ - migrations.CreateModel( - name='CargoBancada', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('nome_cargo', models.CharField(max_length=80, verbose_name='Cargo de Bancada')), - ('cargo_unico', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Cargo Único')), - ], - options={ - 'verbose_name_plural': 'Cargos de Bancada', - 'verbose_name': 'Cargo de Bancada', - }, - ), - ] diff --git a/sapl/sessao/migrations/0020_auto_20160517_1450.py b/sapl/sessao/migrations/0020_auto_20160517_1450.py deleted file mode 100644 index 85004c22f..000000000 --- a/sapl/sessao/migrations/0020_auto_20160517_1450.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-17 17:50 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0019_cargobancada'), - ] - - operations = [ - migrations.AlterField( - model_name='cargobancada', - name='cargo_unico', - field=models.CharField(choices=[(True, 'Sim'), (False, 'Não')], default=False, max_length=10, verbose_name='Cargo Único'), - ), - ] diff --git a/sapl/sessao/migrations/0021_adicionamultiplasmaterias.py b/sapl/sessao/migrations/0021_adicionamultiplasmaterias.py deleted file mode 100644 index 7eb3dbd48..000000000 --- a/sapl/sessao/migrations/0021_adicionamultiplasmaterias.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-03 14:27 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('materia', '0038_auto_20160612_1506'), - ('sessao', '0020_auto_20160517_1450'), - ] - - operations = [ - migrations.CreateModel( - name='AdicionaMultiplasMaterias', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('materia', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa')), - ], - options={ - 'verbose_name_plural': 'Tabela de Adicionar Várias Matérias', - 'verbose_name': 'Tabela de Adicionar Várias Matérias', - }, - ), - ] diff --git a/sapl/sessao/migrations/0022_auto_20160805_0943.py b/sapl/sessao/migrations/0022_auto_20160805_0943.py deleted file mode 100644 index 51acbf4ef..000000000 --- a/sapl/sessao/migrations/0022_auto_20160805_0943.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-08-05 12:43 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0021_adicionamultiplasmaterias'), - ] - - operations = [ - migrations.RemoveField( - model_name='adicionamultiplasmaterias', - name='materia', - ), - migrations.DeleteModel( - name='AdicionaMultiplasMaterias', - ), - ] diff --git a/sapl/sessao/migrations/0023_auto_20160915_1405.py b/sapl/sessao/migrations/0023_auto_20160915_1405.py deleted file mode 100644 index 10a1a0511..000000000 --- a/sapl/sessao/migrations/0023_auto_20160915_1405.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-15 17:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0022_auto_20160805_0943'), - ] - - operations = [ - migrations.AlterField( - model_name='bancada', - name='nome', - field=models.CharField(max_length=80, verbose_name='Nome da Bancada, Bloco, ou Frente'), - ), - ] diff --git a/sapl/sessao/migrations/0024_bloco.py b/sapl/sessao/migrations/0024_bloco.py deleted file mode 100644 index 5af326429..000000000 --- a/sapl/sessao/migrations/0024_bloco.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-19 12:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0023_auto_20160915_1405'), - ] - - operations = [ - migrations.CreateModel( - name='Bloco', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('nome', models.CharField(max_length=80, verbose_name='Nome do Bloco')), - ('data_criacao', models.DateField(blank=True, null=True, verbose_name='Data Criação')), - ('data_extincao', models.DateField(blank=True, null=True, verbose_name='Data Dissolução')), - ('descricao', models.TextField(blank=True, verbose_name='Descrição')), - ('bancadas', models.ManyToManyField(blank=True, to='sessao.Bancada', verbose_name='Bancadas')), - ], - options={ - 'verbose_name_plural': 'Blocos', - 'verbose_name': 'Bloco', - }, - ), - ] diff --git a/sapl/sessao/migrations/0025_auto_20160919_1503.py b/sapl/sessao/migrations/0025_auto_20160919_1503.py deleted file mode 100644 index fe7060645..000000000 --- a/sapl/sessao/migrations/0025_auto_20160919_1503.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-19 18:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('parlamentares', '0027_merge'), - ('sessao', '0024_bloco'), - ] - - operations = [ - migrations.RemoveField( - model_name='bloco', - name='bancadas', - ), - migrations.AddField( - model_name='bloco', - name='partidos', - field=models.ManyToManyField(blank=True, to='parlamentares.Partido', verbose_name='Bancadas'), - ), - ] diff --git a/sapl/sessao/migrations/0026_auto_20160926_1445.py b/sapl/sessao/migrations/0026_auto_20160926_1445.py deleted file mode 100644 index 6380bb8df..000000000 --- a/sapl/sessao/migrations/0026_auto_20160926_1445.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-09-26 17:45 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0025_auto_20160919_1503'), - ] - - operations = [ - migrations.AlterField( - model_name='expedientemateria', - name='materia', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa', verbose_name='Matéria'), - ), - migrations.AlterField( - model_name='expedientemateria', - name='resultado', - field=models.TextField(blank=True, verbose_name='Resultado'), - ), - migrations.AlterField( - model_name='ordemdia', - name='materia', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa', verbose_name='Matéria'), - ), - migrations.AlterField( - model_name='ordemdia', - name='resultado', - field=models.TextField(blank=True, verbose_name='Resultado'), - ), - ] diff --git a/sapl/sessao/migrations/0027_auto_20161003_0417.py b/sapl/sessao/migrations/0027_auto_20161003_0417.py deleted file mode 100644 index 324cd919c..000000000 --- a/sapl/sessao/migrations/0027_auto_20161003_0417.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-03 07:17 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0026_auto_20160926_1445'), - ] - - operations = [ - migrations.AlterModelOptions( - name='bancada', - options={'ordering': ('-legislatura__numero',), 'verbose_name': 'Bancada', 'verbose_name_plural': 'Bancadas'}, - ), - ] diff --git a/sapl/sessao/migrations/0028_auto_20161004_0927.py b/sapl/sessao/migrations/0028_auto_20161004_0927.py deleted file mode 100644 index cd8f78f2f..000000000 --- a/sapl/sessao/migrations/0028_auto_20161004_0927.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-04 12:27 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0027_auto_20161003_0417'), - ] - - operations = [ - migrations.AlterField( - model_name='orador', - name='url_discurso', - field=models.CharField(blank=True, max_length=150, verbose_name='URL Vídeo ou Observação'), - ), - migrations.AlterField( - model_name='oradorexpediente', - name='url_discurso', - field=models.CharField(blank=True, max_length=150, verbose_name='URL Vídeo ou Observação'), - ), - ] diff --git a/sapl/sessao/migrations/0029_auto_20161004_1101.py b/sapl/sessao/migrations/0029_auto_20161004_1101.py deleted file mode 100644 index 070ef640c..000000000 --- a/sapl/sessao/migrations/0029_auto_20161004_1101.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-04 14:01 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0028_auto_20161004_0927'), - ] - - operations = [ - migrations.AddField( - model_name='orador', - name='observacao', - field=models.CharField(blank=True, max_length=150, verbose_name='Observação'), - ), - migrations.AddField( - model_name='oradorexpediente', - name='observacao', - field=models.CharField(blank=True, max_length=150, verbose_name='Observação'), - ), - migrations.AlterField( - model_name='orador', - name='url_discurso', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo'), - ), - migrations.AlterField( - model_name='oradorexpediente', - name='url_discurso', - field=models.URLField(blank=True, max_length=150, verbose_name='URL Vídeo'), - ), - ] diff --git a/sapl/sessao/migrations/0030_auto_20161215_1652.py b/sapl/sessao/migrations/0030_auto_20161215_1652.py deleted file mode 100644 index a804fa820..000000000 --- a/sapl/sessao/migrations/0030_auto_20161215_1652.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-15 16:52 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0029_auto_20161004_1101'), - ] - - operations = [ - migrations.AlterField( - model_name='bancada', - name='nome', - field=models.CharField(max_length=80, verbose_name='Nome da Bancada'), - ), - ] diff --git a/sapl/sessao/migrations/0030_auto_20161216_1640.py b/sapl/sessao/migrations/0030_auto_20161216_1640.py deleted file mode 100644 index 0ae52641f..000000000 --- a/sapl/sessao/migrations/0030_auto_20161216_1640.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.12 on 2016-12-16 16:40 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0029_auto_20161004_1101'), - ] - - operations = [ - migrations.AlterField( - model_name='bancada', - name='nome', - field=models.CharField(max_length=80, verbose_name='Nome da Bancada'), - ), - ] diff --git a/sapl/sessao/migrations/0031_auto_20170102_0951.py b/sapl/sessao/migrations/0031_auto_20170102_0951.py deleted file mode 100644 index c3853373c..000000000 --- a/sapl/sessao/migrations/0031_auto_20170102_0951.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-02 09:51 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0030_auto_20161216_1640'), - ] - - operations = [ - migrations.AlterField( - model_name='cargobancada', - name='cargo_unico', - field=models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Cargo Único ?'), - ), - ] diff --git a/sapl/sessao/migrations/0031_merge.py b/sapl/sessao/migrations/0031_merge.py deleted file mode 100644 index 409f8be4d..000000000 --- a/sapl/sessao/migrations/0031_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-19 13:06 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0030_auto_20161216_1640'), - ('sessao', '0030_auto_20161215_1652'), - ] - - operations = [ - ] diff --git a/sapl/sessao/migrations/0032_auto_20170102_0953.py b/sapl/sessao/migrations/0032_auto_20170102_0953.py deleted file mode 100644 index 7bb56bafa..000000000 --- a/sapl/sessao/migrations/0032_auto_20170102_0953.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-01-02 09:53 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0031_auto_20170102_0951'), - ] - - operations = [ - migrations.AlterField( - model_name='cargobancada', - name='cargo_unico', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Cargo Único ?'), - ), - ] diff --git a/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py b/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py deleted file mode 100644 index 9a846f587..000000000 --- a/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-12-28 09:53 -from __future__ import unicode_literals - -from django.db import migrations, models -import sapl.sessao.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0031_merge'), - ] - - operations = [ - migrations.AddField( - model_name='sessaoplenaria', - name='upload_anexo', - field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo da Sessão'), - ), - ] diff --git a/sapl/sessao/migrations/0033_merge.py b/sapl/sessao/migrations/0033_merge.py deleted file mode 100644 index af3bd0492..000000000 --- a/sapl/sessao/migrations/0033_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-01-10 15:32 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0032_sessaoplenaria_upload_anexo'), - ('sessao', '0032_auto_20170102_0953'), - ] - - operations = [ - ] diff --git a/sapl/sessao/migrations/0034_votonominal.py b/sapl/sessao/migrations/0034_votonominal.py deleted file mode 100644 index 37ab664c7..000000000 --- a/sapl/sessao/migrations/0034_votonominal.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-13 14:37 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('materia', '0075_auto_20170203_1019'), - ('parlamentares', '0039_remove_votante_ip'), - ('sessao', '0033_merge'), - ] - - operations = [ - migrations.CreateModel( - name='VotoNominal', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('voto', models.CharField(max_length=10, verbose_name='Voto')), - ('ip', models.CharField(max_length=30, verbose_name='IP')), - ('data_hora', models.DateTimeField(auto_now_add=True, verbose_name='Data/Hora')), - ('expediente', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sessao.ExpedienteMateria')), - ('materia', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa')), - ('ordem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sessao.OrdemDia')), - ('parlamentar', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Parlamentar')), - ('sessao', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sessao.SessaoPlenaria')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - options={ - 'verbose_name': 'Registro do Voto do Parlamentar', - 'verbose_name_plural': 'Registros dos Votos dos Parlamentares', - }, - ), - ] diff --git a/sapl/sessao/migrations/0035_auto_20170213_1455.py b/sapl/sessao/migrations/0035_auto_20170213_1455.py deleted file mode 100644 index 391c293b0..000000000 --- a/sapl/sessao/migrations/0035_auto_20170213_1455.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2017-02-13 14:55 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('sessao', '0034_votonominal'), - ] - - operations = [ - migrations.RemoveField( - model_name='votonominal', - name='expediente', - ), - migrations.RemoveField( - model_name='votonominal', - name='ordem', - ), - ] diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index ffbb4d753..b76fac9f3 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -1,5 +1,4 @@ import reversion -from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices @@ -32,11 +31,16 @@ class CargoBancada(models.Model): @reversion.register() class Bancada(models.Model): - legislatura = models.ForeignKey(Legislatura, verbose_name=_('Legislatura')) + legislatura = models.ForeignKey(Legislatura, + on_delete=models.PROTECT, + verbose_name=_('Legislatura')) nome = models.CharField( max_length=80, verbose_name=_('Nome da Bancada')) - partido = models.ForeignKey(Partido, blank=True, null=True, + partido = models.ForeignKey(Partido, + blank=True, + null=True, + on_delete=models.PROTECT, verbose_name=_('Partido')) data_criacao = models.DateField(blank=True, null=True, verbose_name=_('Data Criação')) @@ -104,10 +108,16 @@ class SessaoPlenaria(models.Model): # TODO analyze querying all hosted databases ! cod_andamento_sessao = models.PositiveIntegerField(blank=True, null=True) - tipo = models.ForeignKey(TipoSessaoPlenaria, verbose_name=_('Tipo')) + tipo = models.ForeignKey(TipoSessaoPlenaria, + on_delete=models.PROTECT, + verbose_name=_('Tipo')) sessao_legislativa = models.ForeignKey( - SessaoLegislativa, verbose_name=_('Sessão Legislativa')) - legislatura = models.ForeignKey(Legislatura, verbose_name=_('Legislatura')) + SessaoLegislativa, + on_delete=models.PROTECT, + verbose_name=_('Sessão Legislativa')) + legislatura = models.ForeignKey(Legislatura, + on_delete=models.PROTECT, + verbose_name=_('Legislatura')) # XXX seems to be empty data_inicio = models.DateField(verbose_name=_('Abertura')) hora_inicio = models.CharField( @@ -146,6 +156,9 @@ class SessaoPlenaria(models.Model): finalizada = models.NullBooleanField(blank=True, choices=YES_NO_CHOICES, verbose_name=_('Sessão finalizada?')) + interativa = models.NullBooleanField(blank=True, + choices=YES_NO_CHOICES, + verbose_name=_('Sessão interativa')) class Meta: verbose_name = _('Sessão Plenária') @@ -209,8 +222,10 @@ class AbstractOrdemDia(models.Model): (3, 'secreta', (('Secreta'))), ) - sessao_plenaria = models.ForeignKey(SessaoPlenaria) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) materia = models.ForeignKey(MateriaLegislativa, + on_delete=models.PROTECT, verbose_name=_('Matéria')) data_ordem = models.DateField(verbose_name=_('Data da Sessão')) observacao = models.TextField( @@ -254,8 +269,9 @@ class TipoExpediente(models.Model): @reversion.register() class ExpedienteSessao(models.Model): # ExpedienteSessaoPlenaria - sessao_plenaria = models.ForeignKey(SessaoPlenaria) - tipo = models.ForeignKey(TipoExpediente) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) + tipo = models.ForeignKey(TipoExpediente, on_delete=models.PROTECT) conteudo = models.TextField( blank=True, verbose_name=_('Conteúdo do expediente')) @@ -269,9 +285,10 @@ class ExpedienteSessao(models.Model): # ExpedienteSessaoPlenaria @reversion.register() class IntegranteMesa(models.Model): # MesaSessaoPlenaria - sessao_plenaria = models.ForeignKey(SessaoPlenaria) - cargo = models.ForeignKey(CargoMesa) - parlamentar = models.ForeignKey(Parlamentar) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) + cargo = models.ForeignKey(CargoMesa, on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) class Meta: verbose_name = _('Participação em Mesa de Sessão Plenaria') @@ -283,8 +300,11 @@ class IntegranteMesa(models.Model): # MesaSessaoPlenaria @reversion.register() class AbstractOrador(models.Model): # Oradores - sessao_plenaria = models.ForeignKey(SessaoPlenaria) - parlamentar = models.ForeignKey(Parlamentar, verbose_name=_('Parlamentar')) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, + on_delete=models.PROTECT, + verbose_name=_('Parlamentar')) numero_ordem = models.PositiveIntegerField( verbose_name=_('Ordem de pronunciamento')) url_discurso = models.URLField( @@ -328,8 +348,9 @@ class OrdemDia(AbstractOrdemDia): @reversion.register() class PresencaOrdemDia(models.Model): # OrdemDiaPresenca - sessao_plenaria = models.ForeignKey(SessaoPlenaria) - parlamentar = models.ForeignKey(Parlamentar) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) class Meta: verbose_name = _('Presença da Ordem do Dia') @@ -358,10 +379,18 @@ class TipoResultadoVotacao(models.Model): @reversion.register() class RegistroVotacao(models.Model): tipo_resultado_votacao = models.ForeignKey( - TipoResultadoVotacao, verbose_name=_('Resultado da Votação')) - materia = models.ForeignKey(MateriaLegislativa) - ordem = models.ForeignKey(OrdemDia, blank=True, null=True) - expediente = models.ForeignKey(ExpedienteMateria, blank=True, null=True) + TipoResultadoVotacao, + on_delete=models.PROTECT, + verbose_name=_('Resultado da Votação')) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) + ordem = models.ForeignKey(OrdemDia, + blank=True, + null=True, + on_delete=models.PROTECT) + expediente = models.ForeignKey(ExpedienteMateria, + blank=True, + null=True, + on_delete=models.PROTECT) numero_votos_sim = models.PositiveIntegerField(verbose_name=_('Sim')) numero_votos_nao = models.PositiveIntegerField(verbose_name=_('Não')) numero_abstencoes = models.PositiveIntegerField( @@ -383,8 +412,8 @@ class RegistroVotacao(models.Model): @reversion.register() class VotoParlamentar(models.Model): # RegistroVotacaoParlamentar - votacao = models.ForeignKey(RegistroVotacao) - parlamentar = models.ForeignKey(Parlamentar) + votacao = models.ForeignKey(RegistroVotacao, on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) # XXX change to restricted choices voto = models.CharField(max_length=10) @@ -399,13 +428,14 @@ class VotoParlamentar(models.Model): # RegistroVotacaoParlamentar @reversion.register() class VotoNominal(models.Model): - parlamentar = models.ForeignKey(Parlamentar) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) voto = models.CharField(verbose_name=_('Voto'), max_length=10) - sessao = models.ForeignKey(SessaoPlenaria) - materia = models.ForeignKey(MateriaLegislativa) + sessao = models.ForeignKey(SessaoPlenaria, on_delete=models.PROTECT) + materia = models.ForeignKey(MateriaLegislativa, on_delete=models.PROTECT) - user = models.ForeignKey(get_settings_auth_user_model()) + user = models.ForeignKey(get_settings_auth_user_model(), + on_delete=models.PROTECT) ip = models.CharField(verbose_name=_('IP'), max_length=30) data_hora = models.DateTimeField( verbose_name=_('Data/Hora'), auto_now_add=True) @@ -420,8 +450,9 @@ class VotoNominal(models.Model): @reversion.register() class SessaoPlenariaPresenca(models.Model): - sessao_plenaria = models.ForeignKey(SessaoPlenaria) - parlamentar = models.ForeignKey(Parlamentar) + sessao_plenaria = models.ForeignKey(SessaoPlenaria, + on_delete=models.PROTECT) + parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT) data_sessao = models.DateField(blank=True, null=True) class Meta: diff --git a/sapl/sessao/serializers.py b/sapl/sessao/serializers.py new file mode 100644 index 000000000..6d6f4cd9b --- /dev/null +++ b/sapl/sessao/serializers.py @@ -0,0 +1,17 @@ +from rest_framework import serializers + +from .models import SessaoPlenaria + +class SessaoPlenariaSerializer(serializers.Serializer): + class Meta: + model = SessaoPlenaria + fields = ('tipo', + 'sessao_legislativa', + 'legislatura', + 'data_inicio', + 'hora_inicio', + 'hora_fim', + 'url_video', + 'iniciada', + 'finalizada' + ) diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py index e06376fd6..f237bf721 100644 --- a/sapl/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -16,6 +16,7 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente, VotacaoEditView, VotacaoExpedienteEditView, VotacaoExpedienteView, VotacaoNominalEditView, VotacaoNominalExpedienteEditView, + VotacaoNominalExpedienteDetailView, VotacaoNominalExpedienteView, VotacaoNominalView, VotacaoView, abrir_votacao_expediente_view, @@ -120,6 +121,9 @@ urlpatterns = [ url(r'^sessao/(?P\d+)/matexp/votnom/edit/(?P\d+)/(?P\d+)$', VotacaoNominalExpedienteEditView.as_view(), name='votacaonominalexpedit'), + url(r'^sessao/(?P\d+)/matexp/votnom/detail/(?P\d+)/(?P\d+)$', + VotacaoNominalExpedienteDetailView.as_view(), + name='votacaonominalexpdetail'), url(r'^sessao/(?P\d+)/matexp/votsimb/(?P\d+)/(?P\d+)$', VotacaoExpedienteView.as_view(), name='votacaosimbolicaexp'), url(r'^sessao/(?P\d+)/matexp/votsec/view/(?P\d+)/(?P\d+)$', diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 928e5f746..980594784 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -28,7 +28,7 @@ from sapl.materia.models import (Autoria, DocumentoAcessorio, TipoMateriaLegislativa, Tramitacao) from sapl.materia.views import MateriaLegislativaPesquisaView from sapl.norma.models import NormaJuridica -from sapl.parlamentares.models import (Legislatura, Parlamentar, +from sapl.parlamentares.models import (Filiacao, Legislatura, Parlamentar, SessaoLegislativa) from sapl.sessao.apps import AppConfig from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm @@ -164,7 +164,10 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): def get_rows(self, object_list): for obj in object_list: - if not obj.resultado: + exist_resultado = obj.registrovotacao_set.filter( + materia=obj.materia + ).exists() + if not exist_resultado: if obj.votacao_aberta: url = '' if obj.tipo_votacao == 1: @@ -208,6 +211,11 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): else: obj.resultado = '''Não há resultado''' else: + resultado = obj.registrovotacao_set.get( + materia_id=obj.materia_id) + resultado_descricao = resultado.tipo_resultado_votacao.nome + resultado_observacao = resultado.observacao + if self.request.user.has_module_perms(AppConfig.label): url = '' if obj.tipo_votacao == 1: @@ -228,10 +236,14 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): 'pk': obj.sessao_plenaria_id, 'oid': obj.materia_id, 'mid': obj.pk}) - obj.resultado = '%s' % (url, - obj.resultado) + obj.resultado = ('%s
%s' % + (url, + resultado_descricao, + resultado_observacao)) else: - obj.resultado = '%s' % (obj.resultado) + obj.resultado = ('%s
%s' % + (resultado_descricao, + resultado_observacao)) return [self._as_row(obj) for obj in object_list] @@ -268,7 +280,10 @@ class ExpedienteMateriaCrud(MasterDetailCrud): def get_rows(self, object_list): for obj in object_list: - if not obj.resultado: + exist_resultado = obj.registrovotacao_set.filter( + materia=obj.materia + ).exists() + if not exist_resultado: if obj.votacao_aberta: url = '' if obj.tipo_votacao == 1: @@ -310,7 +325,10 @@ class ExpedienteMateriaCrud(MasterDetailCrud): obj.resultado = btn_abrir else: url = '' - + resultado = obj.registrovotacao_set.get( + materia_id=obj.materia_id) + resultado_descricao = resultado.tipo_resultado_votacao.nome + resultado_observacao = resultado.observacao if self.request.user.has_module_perms(AppConfig.label): if obj.tipo_votacao == 1: url = reverse( @@ -331,8 +349,25 @@ class ExpedienteMateriaCrud(MasterDetailCrud): 'pk': obj.sessao_plenaria_id, 'oid': obj.materia_id, 'mid': obj.pk}) - obj.resultado = '%s' % (url, - obj.resultado) + obj.resultado = ('%s
%s' % + (url, + resultado_descricao, + resultado_observacao)) + else: + if obj.tipo_votacao == 2: + url = reverse('sapl.sessao:votacaonominalexpdetail', + kwargs={ + 'pk': obj.sessao_plenaria_id, + 'oid': obj.materia_id, + 'mid': obj.pk}) + obj.resultado = ('%s
%s' % + (url, + resultado_descricao, + resultado_observacao)) + else: + obj.resultado = ('%s
%s' % + (resultado_descricao, + resultado_observacao)) return [self._as_row(obj) for obj in object_list] class CreateView(MasterDetailCrud.CreateView): @@ -603,9 +638,11 @@ class PainelView(PermissionRequiredForAppCrudMixin, TemplateView): cronometro_aparte = AppsAppConfig.attr('cronometro_aparte') cronometro_ordem = AppsAppConfig.attr('cronometro_ordem') - if not cronometro_discurso or not cronometro_aparte or not cronometro_ordem: + if (not cronometro_discurso or not cronometro_aparte + or not cronometro_ordem): msg = _( - 'Você precisa primeiro configurar os cronômetros nas Configurações da Aplicação') + 'Você precisa primeiro configurar os cronômetros \ + nas Configurações da Aplicação') messages.add_message(self.request, messages.ERROR, msg) else: @@ -922,13 +959,13 @@ class ResumoView(DetailView): context.update({'multimidia_audio': _('Audio: ') + str(self.object.url_audio)}) else: - context.update({'multimidia_audio': _('Audio: Indisponivel')}) + context.update({'multimidia_audio': _('Audio: Indisponível')}) if self.object.url_video: context.update({'multimidia_video': _('Video: ') + str(self.object.url_video)}) else: - context.update({'multimidia_video': _('Video: Indisponivel')}) + context.update({'multimidia_video': _('Video: Indisponível')}) # ===================================================================== # Mesa Diretora @@ -980,14 +1017,19 @@ class ResumoView(DetailView): materias_expediente = [] for m in materias: + ementa = m.observacao titulo = m.materia numero = m.numero_ordem - if m.resultado: - resultado = m.resultado + rv = m.registrovotacao_set.first() + if rv: + resultado = rv.tipo_resultado_votacao.nome + resultado_observacao = rv.observacao + else: resultado = _('Matéria não votada') + resultado_observacao = _(' ') autoria = Autoria.objects.filter(materia_id=m.materia_id) autor = [str(x.autor) for x in autoria] @@ -996,6 +1038,7 @@ class ResumoView(DetailView): 'titulo': titulo, 'numero': numero, 'resultado': resultado, + 'resultado_observacao': resultado_observacao, 'autor': autor } materias_expediente.append(mat) @@ -1037,7 +1080,6 @@ class ResumoView(DetailView): # Matérias Ordem do Dia ordem = OrdemDia.objects.filter( sessao_plenaria_id=self.object.id) - materias_ordem = [] for o in ordem: ementa = o.observacao @@ -1045,10 +1087,13 @@ class ResumoView(DetailView): numero = o.numero_ordem # Verificar resultado - if o.resultado: - resultado = o.resultado + rv = o.registrovotacao_set.filter(materia=o.materia).first() + if rv: + resultado = rv.tipo_resultado_votacao.nome + resultado_observacao = rv.observacao else: resultado = _('Matéria não votada') + resultado_observacao = _(' ') autoria = Autoria.objects.filter( materia_id=o.materia_id) @@ -1058,12 +1103,31 @@ class ResumoView(DetailView): 'titulo': titulo, 'numero': numero, 'resultado': resultado, + 'resultado_observacao': resultado_observacao, 'autor': autor } materias_ordem.append(mat) context.update({'materias_ordem': materias_ordem}) + # ===================================================================== + # Oradores nas Explicações Pessoais + oradores_explicacoes = [] + for orador in Orador.objects.filter(sessao_plenaria_id=self.object.id): + for parlamentar in Parlamentar.objects.filter( + id=orador.parlamentar.id): + partido_sigla = Filiacao.objects.filter( + parlamentar=parlamentar).last().partido.sigla + if not partido_sigla: + partido_sigla = '' + oradores = { + 'numero_ordem': orador.numero_ordem, + 'parlamentar': parlamentar, + 'sgl_partido': partido_sigla + } + oradores_explicacoes.append(oradores) + context.update({'oradores_explicacoes': oradores_explicacoes}) + return self.render_to_response(context) @@ -1194,6 +1258,7 @@ class VotacaoEditView(SessaoPermissionMixin): ordem_id=ordem_id).last() votacao_existente = {'observacao': sub( ' ', ' ', strip_tags(votacao.observacao)), + 'resultado': votacao.tipo_resultado_votacao.nome, 'tipo_resultado': votacao.tipo_resultado_votacao_id} context.update({'votacao_titulo': titulo, @@ -1504,6 +1569,7 @@ class VotacaoNominalEditView(SessaoPermissionMixin): votacao_existente = {'observacao': sub( ' ', ' ', strip_tags(votacao.observacao)), + 'resultado': votacao.tipo_resultado_votacao.nome, 'tipo_resultado': votacao.tipo_resultado_votacao_id} context.update({'votacao': votacao_existente, @@ -1736,6 +1802,7 @@ class VotacaoNominalExpedienteEditView(SessaoPermissionMixin): votacao_existente = {'observacao': sub( ' ', ' ', strip_tags(votacao.observacao)), + 'resultado': votacao.tipo_resultado_votacao.nome, 'tipo_resultado': votacao.tipo_resultado_votacao_id} context.update({'votacao': votacao_existente, @@ -1798,6 +1865,51 @@ class VotacaoNominalExpedienteEditView(SessaoPermissionMixin): return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': pk}) +class VotacaoNominalExpedienteDetailView(DetailView): + template_name = 'sessao/votacao/nominal_detail.html' + + def get(self, request, *args, **kwargs): + context = {} + materia_id = kwargs['oid'] + expediente_id = kwargs['mid'] + + votacao = RegistroVotacao.objects.get( + materia_id=materia_id, + expediente_id=expediente_id) + expediente = ExpedienteMateria.objects.get(id=expediente_id) + votos = VotoParlamentar.objects.filter(votacao_id=votacao.id) + + list_votos = [] + for v in votos: + parlamentar = Parlamentar.objects.get(id=v.parlamentar_id) + list_votos.append({'parlamentar': parlamentar, 'voto': v.voto}) + + context.update({'votos': list_votos}) + + materia = {'materia': expediente.materia, + 'ementa': sub( + ' ', ' ', strip_tags(expediente.observacao))} + context.update({'materia': materia}) + + votacao_existente = {'observacao': sub( + ' ', ' ', strip_tags(votacao.observacao)), + 'resultado': votacao.tipo_resultado_votacao.nome, + 'tipo_resultado': + votacao.tipo_resultado_votacao_id} + context.update({'votacao': votacao_existente, + 'tipos': self.get_tipos_votacao()}) + + return self.render_to_response(context) + + def get_tipos_votacao(self): + for tipo in TipoResultadoVotacao.objects.all(): + yield tipo + + def get_success_url(self): + pk = self.kwargs['pk'] + return reverse('sapl.sessao:expedientemateria_list', + kwargs={'pk': pk}) + class VotacaoExpedienteView(SessaoPermissionMixin): @@ -1970,6 +2082,7 @@ class VotacaoExpedienteEditView(SessaoPermissionMixin): expediente_id=expediente_id).last() votacao_existente = {'observacao': sub( ' ', ' ', strip_tags(votacao.observacao)), + 'resultado': votacao.tipo_resultado_votacao.nome, 'tipo_resultado': votacao.tipo_resultado_votacao_id} context.update({'votacao_titulo': titulo, @@ -2063,11 +2176,13 @@ class PautaSessaoDetailView(DetailView): situacao = m.materia.tramitacao_set.last().status if situacao is None: situacao = _("Não informada") - - if m.resultado: - resultado = m.resultado + rv = m.registrovotacao_set.all() + if rv: + resultado = rv[0].tipo_resultado_votacao.nome + resultado_observacao = rv[0].observacao else: resultado = _('Matéria não votada') + resultado_observacao = _(' ') autoria = Autoria.objects.filter(materia_id=m.materia_id) autor = [str(x.autor) for x in autoria] @@ -2077,6 +2192,7 @@ class PautaSessaoDetailView(DetailView): 'titulo': titulo, 'numero': numero, 'resultado': resultado, + 'resultado_observacao': resultado_observacao, 'situacao': situacao, 'autor': autor } @@ -2116,8 +2232,9 @@ class PautaSessaoDetailView(DetailView): numero = o.numero_ordem # Verificar resultado - if o.resultado: - resultado = o.resultado + resultado = o.registrovotacao_set.all() + if resultado: + resultado = resultado[0].tipo_resultado_votacao.nome else: resultado = _('Matéria não votada') @@ -2411,15 +2528,16 @@ class AdicionarVariasMateriasOrdemDia(AdicionarVariasMateriasExpediente): @csrf_exempt +@permission_required('sessao.change_expedientemateria', + 'sessao.change_ordemdia') def mudar_ordem_materia_sessao(request): # Pega os dados vindos da requisição posicao_inicial = int(request.POST['pos_ini']) + 1 posicao_final = int(request.POST['pos_fim']) + 1 pk_sessao = int(request.POST['pk_sessao']) - pk_list = request.POST.getlist('pk_list[]') materia = request.POST['materia'] - + # Verifica se está nas Matérias do Expediente ou da Ordem do Dia if materia == 'expediente': materia = ExpedienteMateria @@ -2434,7 +2552,7 @@ def mudar_ordem_materia_sessao(request): sessao_plenaria=pk_sessao, numero_ordem=posicao_inicial) except ObjectDoesNotExist: - raise # TODO tratar essa exceção + raise # TODO tratar essa exceção # Se a posição inicial for menor que a final, todos que # estiverem acima da nova posição devem ter sua ordem decrementada @@ -2448,7 +2566,6 @@ def mudar_ordem_materia_sessao(request): m.numero_ordem = m.numero_ordem - 1 m.save() - # Se a posição inicial for maior que a final, todos que # estiverem abaixo da nova posição devem ter sua ordem incrementada # em uma posição diff --git a/sapl/settings.py b/sapl/settings.py index 37646e675..694c12a95 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -76,12 +76,34 @@ INSTALLED_APPS = ( 'crispy_forms', 'easy_thumbnails', 'floppyforms', + 'haystack', 'sass_processor', 'rest_framework', 'reversion', + 'whoosh', ) + SAPL_APPS +# FTS = Full Text Search +SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine' +SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh')) + +SOLR_URL = config('SOLR_URL', cast=str, default='') +if SOLR_URL: + SEARCH_BACKEND = 'haystack.backends.solr_backend.SolrEngine' + SEARCH_URL = ('URL', config('SOLR_URL', cast=str)) + # ...or for multicore... + # 'URL': 'http://127.0.0.1:8983/solr/mysite', + + +HAYSTACK_CONNECTIONS = { + 'default': { + 'ENGINE': SEARCH_BACKEND, + SEARCH_URL[0] : SEARCH_URL[1] + }, +} + + if DEBUG: INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',) @@ -100,10 +122,7 @@ MIDDLEWARE_CLASSES = ( REST_FRAMEWORK = { - "DEFAULT_RENDERER_CLASSES": ( - "rest_framework.renderers.JSONRenderer", - # "rest_framework.renderers.BrowsableAPIRenderer", - ), + "UNICODE_JSON": False, "DEFAULT_PARSER_CLASSES": ( "rest_framework.parsers.JSONParser", ), @@ -197,6 +216,7 @@ LOCALE_PATHS = ( # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ + STATIC_URL = '/static/' STATIC_ROOT = PROJECT_DIR.child("collected_static") STATICFILES_DIRS = (BASE_DIR.child("static"),) @@ -226,6 +246,7 @@ BOWER_INSTALLED_APPS = ( 'jQuery-Mask-Plugin#1.14.0', 'jsdiff#2.2.2', 'https://github.com/interlegis/drunken-parrot-flat-ui.git', + 'jquery-query-object#2.2.3', ) # Additional search paths for SASS files when using the @import statement diff --git a/sapl/static/XSLT/HTML/.objects b/sapl/static/XSLT/HTML/.objects new file mode 100644 index 000000000..ca1ce01f2 --- /dev/null +++ b/sapl/static/XSLT/HTML/.objects @@ -0,0 +1,11 @@ +estilo.css:DTML Method +indicacao.xsl:File +mocao.xsl:File +mocao2.xsl:File +parecer.xsl:File +pedido.xsl:File +pedido2.xsl:File +pl.xsl:File +pl2.xsl:File +requerimento.xsl:File +requerimento2.xsl:File diff --git a/sapl/static/XSLT/HTML/estilo.css b/sapl/static/XSLT/HTML/estilo.css new file mode 100644 index 000000000..aac85f176 --- /dev/null +++ b/sapl/static/XSLT/HTML/estilo.css @@ -0,0 +1,95 @@ + body { + font-family: Times; + text-align: justify; + font-size: 12 pt; + margin: 5px 1cm 20px 2cm; +} + + p, + .p{ + font-family: Times; + text-align: justify; + font-size: 12pt; + text-indent: 1.5cm; + margin: 40px 0 20px 0; + } + + .pequeno { + font-family: Times; + text-align: left; + font-size: 13pt; + margin: 0px 0 0px 0; + } + + .cabecalho { + font-family: Times; + font-weight:bold; + text-align: left; + font-size: 15pt; + margin: 10px 0 0px 0; + } + + .texto { + font-family: Times; + text-align: justify; + font-size: 12pt; + margin: 0px 0px 0px 0px; + } + + .data { + text-align: right; + } + + .autor { + text-align: center; + } + + .center { + text-align: center; + } + + .semrecuo { + text-indent: 0; + } + + .ementa { + text-align: justify; + margin-left: 50%; + text-indent: 0; + } + + .titulos1 { + text-align: center; + margin: 10px 0 0px 0; + } + + .titulos2 { + text-align: center; + margin: 0px 0 0px 0; + } + + p.artigo { + text-align: justify; + text-indent: 1cm; + margin: 10px 0 0px 0; +} + + +#imagem { + float:left; + } + +#autores + { + -moz-column-count:3; /* Firefox */ + -webkit-column-count:3; /* Safari and Chrome */ + width:50px; + + } + +#col1 { width: 33%; float: left; center: 10px; } +#col2 { width: 33%; float: left; center: 10px; } +#col3 { width: 33%; float: left; center: 10px; } + + + diff --git a/sapl/static/XSLT/HTML/indicacao.xsl b/sapl/static/XSLT/HTML/indicacao.xsl new file mode 100644 index 000000000..edb4575c7 --- /dev/null +++ b/sapl/static/XSLT/HTML/indicacao.xsl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + +
+
+

+


+

Cmara Municipal de Agudo

+

Estado do Rio Grande do Sul





+
+

+ +
+ +

+
+ + +

+
+ + +

+ +
+ +

+
+ + +

+
+ +
diff --git a/sapl/static/XSLT/HTML/mocao.xsl b/sapl/static/XSLT/HTML/mocao.xsl new file mode 100644 index 000000000..adb7ef3c9 --- /dev/null +++ b/sapl/static/XSLT/HTML/mocao.xsl @@ -0,0 +1,41 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sapl/static/XSLT/HTML/mocao2.xsl b/sapl/static/XSLT/HTML/mocao2.xsl new file mode 100644 index 000000000..14f71c982 --- /dev/null +++ b/sapl/static/XSLT/HTML/mocao2.xsl @@ -0,0 +1,45 @@ + + + + + + + + + + +
+
+ +


+

Cmara Municipal de Agudo

+

Estado do Rio Grande do Sul





+
+ + + +
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ +
\ No newline at end of file diff --git a/sapl/static/XSLT/HTML/parecer.xsl b/sapl/static/XSLT/HTML/parecer.xsl new file mode 100644 index 000000000..14100320e --- /dev/null +++ b/sapl/static/XSLT/HTML/parecer.xsl @@ -0,0 +1,41 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sapl/static/XSLT/HTML/pedido.xsl b/sapl/static/XSLT/HTML/pedido.xsl new file mode 100644 index 000000000..9e5002d01 --- /dev/null +++ b/sapl/static/XSLT/HTML/pedido.xsl @@ -0,0 +1,47 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sapl/static/XSLT/HTML/pedido2.xsl b/sapl/static/XSLT/HTML/pedido2.xsl new file mode 100644 index 000000000..facc154c6 --- /dev/null +++ b/sapl/static/XSLT/HTML/pedido2.xsl @@ -0,0 +1,53 @@ + + + + + + + + + + +
+
+ +


+

Cmara Municipal de Agudo

+

Estado do Rio Grande do Sul





+
+ + + +
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ +
\ No newline at end of file diff --git a/sapl/static/XSLT/HTML/pl.xsl b/sapl/static/XSLT/HTML/pl.xsl new file mode 100644 index 000000000..0da6eddb4 --- /dev/null +++ b/sapl/static/XSLT/HTML/pl.xsl @@ -0,0 +1,105 @@ + + + + + + + + <xsl:value-of select="@id"/> + + + + + + + + + +
+

PROPOSIO

+
+ +
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +

+ +

+
+ +
+

JUSTIFICATIVA

+
+

+ +

+
+ +
+

MENSAGEM

+
+

+ +

+
+
\ No newline at end of file diff --git a/sapl/static/XSLT/HTML/pl2.xsl b/sapl/static/XSLT/HTML/pl2.xsl new file mode 100644 index 000000000..f68506f95 --- /dev/null +++ b/sapl/static/XSLT/HTML/pl2.xsl @@ -0,0 +1,100 @@ + + + + + + + + + + +
+
+ +


+

Cmara Municipal de Agudo

+

Estado do Rio Grande do Sul





+
+ + + + +
+ + +

+
+ + +

+
+ + +

+
+ + +

+

+
+ + +

+

+
+ + +

+

+
+ + +

+

+
+ + +

+

+
+ + +

+

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ +
\ No newline at end of file diff --git a/sapl/static/XSLT/HTML/requerimento.xsl b/sapl/static/XSLT/HTML/requerimento.xsl new file mode 100644 index 000000000..58f202b09 --- /dev/null +++ b/sapl/static/XSLT/HTML/requerimento.xsl @@ -0,0 +1,52 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sapl/static/XSLT/HTML/requerimento2.xsl b/sapl/static/XSLT/HTML/requerimento2.xsl new file mode 100644 index 000000000..3d63f6cf8 --- /dev/null +++ b/sapl/static/XSLT/HTML/requerimento2.xsl @@ -0,0 +1,57 @@ + + + + + + + + + + +
+
+ +


+

Cmara Municipal de Agudo

+

Estado do Rio Grande do Sul





+
+ + + +
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+ +
+ +

+ +
+ +

+
+ + +

+
+ +
\ No newline at end of file diff --git a/sapl/static/js/app.js b/sapl/static/js/app.js index d96090f5e..bbb54171a 100644 --- a/sapl/static/js/app.js +++ b/sapl/static/js/app.js @@ -217,3 +217,20 @@ $(document).ready(function(){ OptionalCustomFrontEnd(); }); + + +function getCookie(name) { + var cookieValue = null; + if (document.cookie && document.cookie !== '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) === (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} \ No newline at end of file diff --git a/sapl/static/styles/style_tinymce.css b/sapl/static/styles/style_tinymce.css deleted file mode 100644 index d2909b025..000000000 --- a/sapl/static/styles/style_tinymce.css +++ /dev/null @@ -1,8 +0,0 @@ -.mce-content-body { - font-family: "Open Sans" "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; - font-style: normal; - font-weight: normal; - line-height: 1.5; - font-size: 1em; - color: #444444; -} \ No newline at end of file diff --git a/sapl/templates/base.html b/sapl/templates/base.html index 450a97799..51351e7a0 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -55,7 +55,7 @@ -
  • +
  • {% if not user.is_authenticated %}
  • {% else %} @@ -224,6 +224,8 @@ + + {% block extra_js %}{% endblock %} {% endblock foot_js %} diff --git a/sapl/templates/base/RelatorioPresencaSessao_filter.html b/sapl/templates/base/RelatorioPresencaSessao_filter.html index 8aeae7aa6..c9c92328b 100644 --- a/sapl/templates/base/RelatorioPresencaSessao_filter.html +++ b/sapl/templates/base/RelatorioPresencaSessao_filter.html @@ -37,7 +37,7 @@ {% for p in parlamentares %} - {{p}} / {{p.filiacao_set.first.partido.sigla|default:"Sem Partido"}} + {{p}} / {{p.filiacao_atual|default:"Sem Partido"}} {{p.sessao_count}} {{p.sessao_porc}} {{p.ordemdia_count}} diff --git a/sapl/templates/materia/layouts.yaml b/sapl/templates/materia/layouts.yaml index 99b91afa3..6045d61d9 100644 --- a/sapl/templates/materia/layouts.yaml +++ b/sapl/templates/materia/layouts.yaml @@ -36,6 +36,16 @@ MateriaLegislativa: - indexacao - observacao +AssuntoMateria: + {% trans 'Assunto de Matéria Legislativa' %}: + - assunto + - dispositivo + +MateriaAssunto: + {% trans 'Assuntos da Matéria' %}: + - assunto + - materia + Anexada: {% trans 'Matéria Anexada' %}: - tipo numero ano diff --git a/sapl/templates/materia/materialegislativa_filter.html b/sapl/templates/materia/materialegislativa_filter.html index 639031d16..a36f6cceb 100644 --- a/sapl/templates/materia/materialegislativa_filter.html +++ b/sapl/templates/materia/materialegislativa_filter.html @@ -4,6 +4,10 @@ {% block actions %}
    + + Pesquisa Textual + + {% if perms.materia %} {% blocktrans with verbose_name=view.verbose_name %} Adicionar Matéria Legislativa {% endblocktrans %} @@ -43,6 +47,14 @@ Apresentação: {{ m.data_apresentacao }}
    {% endif %} + {% if m.numeracao_set.first %} + Processo: {{ m.numeracao_set.first.numero_materia }} / {{ m.numeracao_set.first.ano_materia }} +
    + {% endif %} + {% if m.numero_protocolo %} + Protocolo: {{m.numero_protocolo}}/{{m.ano}}    Data Entrada: {{m.data_entrada_protocolo}}
    + + {% endif %} {% if m.autoria_set.all %} Autores: {% for a in m.autoria_set.all %} @@ -53,7 +65,7 @@ {% endif %} {% endfor %}
    - {% endif %} + {% endif %} {% if m.tramitacao_set.last.unidade_tramitacao_destino %} Localização Atual:  {{m.tramitacao_set.last.unidade_tramitacao_destino}}
    {% endif %} @@ -75,6 +87,7 @@ {% endif %} {% if m.tramitacao_set.last.data_tramitacao %} Data da última Tramitação:  {{m.tramitacao_set.last.data_tramitacao}}
    + Ultima Ação:   {{m.tramitacao_set.last.texto}}
    {% endif %} {% if m.anexo_de.exists %} {% for a in m.materia_anexada_set.all %} @@ -112,6 +125,9 @@ {% endfor %} {% endif %}

    + {% if m.tramitacao_set.all.exists %} +
    Acompanhar Matéria + {% endif %} {% endfor %} {% else %} diff --git a/sapl/templates/materia/subnav.yaml b/sapl/templates/materia/subnav.yaml index d59930cc4..c2ea4cd71 100644 --- a/sapl/templates/materia/subnav.yaml +++ b/sapl/templates/materia/subnav.yaml @@ -3,6 +3,8 @@ url: materialegislativa_detail - title: {% trans 'Anexada' %} url: anexada_list +- title: {% trans 'Assunto' %} + url: materiaassunto_list - title: {% trans 'Autoria' %} url: autoria_list - title: {% trans 'Despacho Inicial' %} diff --git a/sapl/templates/norma/normajuridica_filter.html b/sapl/templates/norma/normajuridica_filter.html index 8350f19e7..7c5d50e42 100644 --- a/sapl/templates/norma/normajuridica_filter.html +++ b/sapl/templates/norma/normajuridica_filter.html @@ -4,6 +4,11 @@ {% block actions %} + {% else %} -
    - {% csrf_token %} -
    - Escolha da Legislatura e da Sessão Legislativa -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    - Escolha da Composição da Mesa Diretora -
    -
    - - -
    - -
    -

    - {% if cargos_vagos %} - {% if perms.parlamentares.add_cargomesa %} - - {% endif %} - {% endif %} -
    -
    - {% if perms.parlamentares.add_composicaomesa %} - - {% endif %} -
    - - {% if cargos_vagos %} -
    - - -
    - -
    - {% endif %} - -
    -
    -
    + + + + +
    + Escolha da Legislatura e da Sessão Legislativa +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    + Escolha da Composição da Mesa Diretora +
    +
    + + +
    + +
    +

    + {% if perms.parlamentares.add_cargomesa %} + + {% endif %} +
    +
    + {% if perms.parlamentares.add_composicaomesa %} + + {% endif %} +
    + +
    + + +
    + +
    + +
    +
    {% endif %} {% endblock detail_content %} + + +{% block extra_js %} + + + +{% endblock %} diff --git a/sapl/templates/parlamentares/parlamentar_perfil_publico.html b/sapl/templates/parlamentares/parlamentar_perfil_publico.html index 11bfc6bfc..1c5ead0fc 100644 --- a/sapl/templates/parlamentares/parlamentar_perfil_publico.html +++ b/sapl/templates/parlamentares/parlamentar_perfil_publico.html @@ -31,7 +31,7 @@
    -

    Partido:   {{object.filiacao_set.first.partido|default_if_none:"Não informado"}}

    +

    Partido:   {{object.filiacao_atual|default_if_none:"Não informado"}}

    diff --git a/sapl/templates/parlamentares/public_composicaomesa_form.html b/sapl/templates/parlamentares/public_composicaomesa_form.html index ef04f6a3c..6eaa3f6e5 100644 --- a/sapl/templates/parlamentares/public_composicaomesa_form.html +++ b/sapl/templates/parlamentares/public_composicaomesa_form.html @@ -10,7 +10,7 @@
    - {% for l in legislaturas %}
    - {% for s in sessoes %}
    {% for o in oradores %} -
    {{o.numero_ordem}} - {{o.parlamentar}}
    -
    {{o.url_discurso}}
    +
    {{o.numero_ordem}} - {{o.parlamentar}}
    +
    {{o.url_discurso}}
    +
    {% endfor %}
    @@ -123,7 +125,7 @@ Lista de Presença na Ordem do Dia
    {% for p in presenca_ordem %} -
    {{p}}
    +
    {{p.nome_parlamentar}} / {{ p.filiacao_atual }}
    {% endfor %}
    @@ -148,10 +150,26 @@ Autor{{ m.autor|length|pluralize:"es" }}: {{ m.autor|join:', ' }} {{m.ementa|safe}} - {{m.resultado}} + {{m.resultado}}
    {{m.resultado_observacao}} {% endfor %} + +
    + Oradores das Explicações Pessoais +
    +
    Parlamentar
    +
    Discurso
    +
    +
    + {% for o in oradores_explicacoes %} +
    {{o.numero_ordem}} - {{o.parlamentar.nome_parlamentar}} / {{ o.parlamentar.filiacao_atual }}
    +
    {{o.url_discurso}}
    +
    + {% endfor %} +
    +
    + {% endblock detail_content %} diff --git a/sapl/templates/sessao/sessaoplenaria_filter.html b/sapl/templates/sessao/sessaoplenaria_filter.html index b4aa4ca98..8c77a3ee2 100644 --- a/sapl/templates/sessao/sessaoplenaria_filter.html +++ b/sapl/templates/sessao/sessaoplenaria_filter.html @@ -9,16 +9,11 @@ {% blocktrans with verbose_name=view.verbose_name %} Adicionar Sessão Plenária {% endblocktrans %} {% endif %} - {% if filter_url %} - {% trans 'Fazer nova pesquisa' %} - {% endif %}
    {% endblock %} {% block detail_content %} - {% if not filter_url %} - {% crispy filter.form %} - {% endif %} + {% crispy filter.form %} {% if filter_url %}

    @@ -51,3 +46,41 @@ {% endblock detail_content %} {% block table_content %} {% endblock table_content %} + + +{% block extra_js %} + + + +{% endblock %} \ No newline at end of file diff --git a/sapl/templates/sessao/sessaoplenaria_form.html b/sapl/templates/sessao/sessaoplenaria_form.html index cf8cbd64f..81057ba57 100644 --- a/sapl/templates/sessao/sessaoplenaria_form.html +++ b/sapl/templates/sessao/sessaoplenaria_form.html @@ -31,7 +31,6 @@ $(function() { function altera_legislatura(){ - console.debug('hey'); var id_legislatura = $("#id_legislatura").val(); var id_sessao_leg = $("#id_sessao_legislativa").val(); $("#id_sessao_legislativa option").remove(); diff --git a/sapl/templates/sessao/votacao/nominal_detail.html b/sapl/templates/sessao/votacao/nominal_detail.html new file mode 100644 index 000000000..e27fd3c53 --- /dev/null +++ b/sapl/templates/sessao/votacao/nominal_detail.html @@ -0,0 +1,54 @@ +{% extends "crud/detail.html" %} +{% load i18n %} + +{% block detail_content %} +
    + {% csrf_token %} + +
    + Votação Nominal +
    + Matéria: {{materia.materia|safe}} +
    + Ementa: {{materia.ementa|safe}} +
    + +
    +
    + Votos +
    + {% for v in votos %} +
    {{v.parlamentar}}
    +
    {{v.voto}}
    + {% endfor %} +
    +
    +
    +
    +
    +
    + Resultado da Votação: + {% for tipo in tipos %} + {% if votacao.tipo_resultado == tipo.id %} + {{ tipo.nome }} + {% endif %} + {% endfor %} +
    +
    + +
    +
    +
    + Observações + +
    +
    +
    +
    +{% endblock detail_content %} + +{% block foot_js %} + +{% endblock %} diff --git a/sapl/templates/sessao/votacao/votacao_edit.html b/sapl/templates/sessao/votacao/votacao_edit.html index 5c614ea00..753c49541 100644 --- a/sapl/templates/sessao/votacao/votacao_edit.html +++ b/sapl/templates/sessao/votacao/votacao_edit.html @@ -26,12 +26,10 @@
    - Resultado da Votação: - {% for tipo in view.get_tipos_votacao %} - {% if votacao.tipo_resultado == tipo.id %} - {{ tipo.nome }} - {% endif %} - {% endfor %} +
    + Resultado da Votação: {{ votacao.resultado }} +
    +
    diff --git a/sapl/templates/sistema.html b/sapl/templates/sistema.html index cc6cddfc0..99b9c7062 100644 --- a/sapl/templates/sistema.html +++ b/sapl/templates/sistema.html @@ -64,6 +64,7 @@ +

    diff --git a/sapl/test_urls.py b/sapl/test_urls.py index bcddfcc9e..40339cef7 100644 --- a/sapl/test_urls.py +++ b/sapl/test_urls.py @@ -361,6 +361,7 @@ for item in _lista_urls: __lista_urls.append((oper, item))""" +@pytest.mark.skip(reason="TODO: Lento demais. Precisa ser refatorado") @pytest.mark.django_db(transaction=False) @pytest.mark.parametrize('url_item', _lista_urls) def test_permissions_urls_for_users_by_apps(url_item, client): @@ -402,7 +403,7 @@ def test_permissions_urls_for_users_by_apps(url_item, client): container, como é o caso de proposições que possui restrição por usuário e não só por, ou não tem, o campo permission_required """ - if PermissionRequiredForAppCrudMixin in type.mro(key.view_class): + if issubclass(key.view_class, PermissionRequiredForAppCrudMixin): # essa classe deve informar app_label assert hasattr(key.view_class, 'app_label') # app_label deve ter conteudo diff --git a/sapl/urls.py b/sapl/urls.py index 58deafa3a..fe6bcc71e 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -57,6 +57,10 @@ urlpatterns = [ url(r'^favicon\.ico$', RedirectView.as_view( url='/static/img/favicon.ico', permanent=True)), + + # Folhas XSLT e extras referenciadas por documentos migrados do sapl 2.5 + url(r'^XSLT/HTML/(?P.*)$', RedirectView.as_view( + url='/static/XSLT/HTML/%(path)s', permanent=False)), ] diff --git a/sapl/utils.py b/sapl/utils.py index 09902fae9..81ebea6cc 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -1,9 +1,12 @@ import hashlib import logging +import os import re from datetime import date from functools import wraps from unicodedata import normalize as unicodedata_normalize +from subprocess import PIPE, call +from threading import Thread import django_filters import magic @@ -16,13 +19,12 @@ from django.contrib import admin from django.contrib.contenttypes.fields import (GenericForeignKey, GenericRel, GenericRelation) from django.core.exceptions import ValidationError -from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ from floppyforms import ClearableFileInput from reversion.admin import VersionAdmin from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row -from sapl.settings import BASE_DIR +from sapl.settings import BASE_DIR, PROJECT_DIR sapl_logger = logging.getLogger(BASE_DIR.name) @@ -365,6 +367,10 @@ TIPOS_IMG_PERMITIDOS = ( def fabrica_validador_de_tipos_de_arquivo(lista, nome): def restringe_tipos_de_arquivo(value): + if not os.path.splitext(value.path)[1][:1]: + raise ValidationError(_( + 'Não é possível fazer upload de arquivos sem extensão.')) + mime = magic.from_buffer(value.read(), mime=True) if mime not in lista: raise ValidationError(_('Tipo de arquivo não suportado')) @@ -372,6 +378,7 @@ def fabrica_validador_de_tipos_de_arquivo(lista, nome): restringe_tipos_de_arquivo.__name__ = nome return restringe_tipos_de_arquivo + restringe_tipos_de_arquivo_txt = fabrica_validador_de_tipos_de_arquivo( TIPOS_TEXTO_PERMITIDOS, 'restringe_tipos_de_arquivo_txt') restringe_tipos_de_arquivo_img = fabrica_validador_de_tipos_de_arquivo( @@ -383,6 +390,7 @@ def intervalos_tem_intersecao(a_inicio, a_fim, b_inicio, b_fim): menor_fim = min(a_fim, b_fim) return maior_inicio <= menor_fim + """ def permissoes(nome_grupo, app_label): lista_permissoes = [] @@ -609,10 +617,36 @@ def texto_upload_path(instance, filename, subpath=''): filename = re.sub('[^a-zA-Z0-9.]', '-', filename).strip('-').lower() filename = re.sub('[-]+', '-', filename) - path = './sapl/%(model_name)s/%(pk)s/%(subpath)s%(filename)s' % { - 'model_name': instance._meta.model_name, - 'pk': instance.pk, - 'subpath': subpath, - 'filename': filename} + prefix = 'public' + + from sapl.materia.models import Proposicao + from sapl.protocoloadm.models import DocumentoAdministrativo + if isinstance(instance, (DocumentoAdministrativo, Proposicao)): + prefix = 'private' + + path = './sapl/%(prefix)s/%(model_name)s/%(pk)s/%(subpath)s%(filename)s' %\ + { + 'prefix': prefix, + 'model_name': instance._meta.model_name, + 'pk': instance.pk, + 'subpath': subpath, + 'filename': filename + } return path + + +class UpdateIndexCommand(Thread): + def run(self): + call([PROJECT_DIR.child('manage.py'), 'update_index'], + stdout=PIPE) + + +def save_texto(sender, instance, **kwargs): + update_index = UpdateIndexCommand() + update_index.start() + + +def delete_texto(sender, instance, **kwargs): + update_index = UpdateIndexCommand() + update_index.start() diff --git a/scripts/fk_protocoloadm_docadm.py b/scripts/fk_protocoloadm_docadm.py index cb66a74bd..a4294206c 100644 --- a/scripts/fk_protocoloadm_docadm.py +++ b/scripts/fk_protocoloadm_docadm.py @@ -3,6 +3,7 @@ from django.core.exceptions import ObjectDoesNotExist + from sapl.protocoloadm.models import DocumentoAdministrativo, Protocolo diff --git a/scripts/gerar_grafico_apps.sh b/scripts/gerar_grafico_apps.sh new file mode 100644 index 000000000..312f04b0c --- /dev/null +++ b/scripts/gerar_grafico_apps.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python -c "from sapl.settings import SAPL_APPS; print(*[s.split('.')[-1] for s in SAPL_APPS])" | xargs -t ./manage.py graph_models -d -g -o zzz.png -l fdp diff --git a/scripts_docker/shell_sapl.sh b/scripts_docker/shell_sapl.sh index cfddefcdc..4c993a61d 100755 --- a/scripts_docker/shell_sapl.sh +++ b/scripts_docker/shell_sapl.sh @@ -1,2 +1,3 @@ #!/bin/bash -docker run -ti sapl_web /bin/bash + +docker run --rm -ti sapl_web /bin/sh diff --git a/start.sh b/start.sh new file mode 100755 index 000000000..1b00801a2 --- /dev/null +++ b/start.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +create_env() { + echo "[ENV FILE] creating .env file..." + # check if file exists + if [ -f "/var/interlegis/sapl/data/secret.key" ]; then + KEY=`cat /var/interlegis/sapl/data/secret.key` + else + KEY=`python3 genkey.py` + echo $KEY > data/secret.key + fi + + FILENAME="/var/interlegis/sapl/sapl/.env" + + if [ -z "${DATABASE_URL:-}" ]; then + DATABASE_URL="postgresql://sapl:sapl@sapldb:5432/sapl" + fi + + # ALWAYS replace the content of .env variable + # If want to conditionally create only if absent then use IF below + # if [ ! -f $FILENAME ]; then + + touch $FILENAME + + + # explicitly use '>' to erase any previous content + echo "SECRET_KEY="$KEY > $FILENAME + # now only appends + echo "DATABASE_URL = "$DATABASE_URL >> $FILENAME + echo "DEBUG = ""${DEBUG-False}" >> $FILENAME + echo "EMAIL_USE_TLS = ""${USE_TLS-True}" >> $FILENAME + echo "EMAIL_PORT = ""${EMAIL_PORT-587}" >> $FILENAME + echo "EMAIL_HOST = ""${EMAIL_HOST-''}" >> $FILENAME + echo "EMAIL_HOST_USER = ""${EMAIL_HOST_USER-''}" >> $FILENAME + echo "EMAIL_HOST_PASSWORD = ""${EMAIL_HOST_PASSWORD-''}" >> $FILENAME + + echo "[ENV FILE] done." +} + +create_env + +#python3 manage.py bower install + +/bin/sh busy-wait.sh $DATABASE_URL + +python3 manage.py migrate +#python3 manage.py collectstatic --no-input +python3 manage.py rebuild_index --noinput & + +user_created=$(python3 create_admin.py 2>&1) + +cmd=$(echo $user_created | grep 'ADMIN_USER_EXISTS') +user_exists=$? + +cmd=$(echo $user_created | grep 'MISSING_ADMIN_PASSWORD') +lack_pwd=$? + +if [ $user_exists -eq 0 ]; then + echo "[SUPERUSER CREATION] User admin already exists. Not creating" +fi + +if [ $lack_pwd -eq 0 ]; then + echo "[SUPERUSER] Environment variable $ADMIN_PASSWORD for superuser admin was not set. Leaving container" + # return -1 +fi + + +/bin/sh gunicorn_start.sh no-venv & +/usr/sbin/nginx -g "daemon off;"