mirror of https://github.com/interlegis/sapl.git
56 changed files with 937 additions and 382 deletions
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-06 15:36 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('audiencia', '0004_auto_20180305_1006'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='audienciapublica', |
|||
name='hora_fim', |
|||
field=models.CharField(blank=True, max_length=5, null=True, verbose_name='Horário Fim(hh:mm)'), |
|||
), |
|||
] |
|||
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-08 11:56 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('audiencia', '0005_auto_20180806_1236'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='audienciapublica', |
|||
name='hora_fim', |
|||
field=models.CharField(blank=True, max_length=5, verbose_name='Horário Fim(hh:mm)'), |
|||
), |
|||
] |
|||
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-01 19:52 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('base', '0017_appconfig_cronometro_consideracoes'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='autor', |
|||
name='nome', |
|||
field=models.CharField(blank=True, max_length=120, verbose_name='Nome do Autor'), |
|||
), |
|||
] |
|||
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-15 13:25 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('base', '0018_auto_20180801_1652'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='autor', |
|||
name='tipo', |
|||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='base.TipoAutor', verbose_name='Tipo do Autor'), |
|||
), |
|||
] |
|||
@ -0,0 +1,59 @@ |
|||
import yaml |
|||
from unipath import Path |
|||
|
|||
from sapl.legacy.migracao_dados import DIR_REPO, exec_legado |
|||
|
|||
fks_legado = ''' |
|||
autor cod_parlamentar parlamentar |
|||
autor tip_autor tipo_autor |
|||
autoria cod_autor autor |
|||
expediente_materia cod_materia materia_legislativa |
|||
ordem_dia cod_materia materia_legislativa |
|||
legislacao_citada cod_norma norma_juridica |
|||
oradores cod_parlamentar parlamentar |
|||
oradores_expediente cod_parlamentar parlamentar |
|||
ordem_dia_presenca cod_parlamentar parlamentar |
|||
protocolo cod_autor autor |
|||
registro_votacao tip_resultado_votacao tipo_resultado_votacao |
|||
registro_votacao_parlamentar cod_parlamentar parlamentar |
|||
registro_votacao_parlamentar cod_votacao registro_votacao |
|||
sessao_legislativa num_legislatura legislatura |
|||
sessao_plenaria_presenca cod_parlamentar parlamentar |
|||
''' |
|||
fks_legado = [l.split() for l in fks_legado.strip().splitlines()] |
|||
fks_legado = {(o, c): t for (o, c, t) in fks_legado} |
|||
|
|||
|
|||
def get_excluido(fk): |
|||
campo, valor, tabela_origem = [fk[k] for k in ('campo', 'valor', 'tabela')] |
|||
tabela_alvo = fks_legado[(tabela_origem, campo)] |
|||
sql = 'select ind_excluido, t.* from {} t where {} = {}'.format( |
|||
tabela_alvo, campo, valor) |
|||
res = list(exec_legado(sql)) |
|||
return tabela_origem, campo, valor, tabela_alvo, res |
|||
|
|||
|
|||
def get_dependencias_a_ressucitar(): |
|||
ocorrencias = yaml.load( |
|||
Path(DIR_REPO.child('ocorrencias.yaml').read_file())) |
|||
fks = ocorrencias['fk'] |
|||
excluidos = [get_excluido(fk) for fk in fks] |
|||
desexcluir, criar = [ |
|||
set([(tabela_alvo, campo, valor) |
|||
for tabela_origem, campo, valor, tabela_alvo, res in excluidos |
|||
if condicao(res)]) |
|||
for condicao in ( |
|||
# o registro existe e ind_excluido == 1 |
|||
lambda res: res and res[0][0] == 1, |
|||
# o registro não existe |
|||
lambda res: not res |
|||
)] |
|||
return desexcluir, criar |
|||
|
|||
|
|||
def get_sqls_desexcluir_criar(desexcluir, criar): |
|||
sqls_desexcluir = [ |
|||
'update {} set ind_excluido = 0 where {} = {};'.format( |
|||
tabela_alvo, campo, valor) |
|||
for tabela_alvo, campo, valor in desexcluir] |
|||
return '\n'.join(sqls_desexcluir) |
|||
@ -0,0 +1,31 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-06 19:48 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import sapl.norma.models |
|||
import sapl.utils |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('norma', '0011_auto_20180220_1859'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='AnexoNormaJuridica', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('anexo_arquivo', models.FileField(blank=True, null=True, upload_to=sapl.norma.models.norma_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Arquivo Anexo')), |
|||
('ano', models.PositiveSmallIntegerField(choices=[(2018, 2018), (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')), |
|||
('norma', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='norma', to='norma.NormaJuridica', verbose_name='Norma Juridica')), |
|||
], |
|||
options={ |
|||
'verbose_name_plural': 'Anexos da Norma Juridica', |
|||
'verbose_name': 'Anexo da Norma Juridica', |
|||
}, |
|||
), |
|||
] |
|||
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.9.13 on 2018-08-14 15:37 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('parlamentares', '0023_auto_20180626_1524'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='mandato', |
|||
name='titular', |
|||
field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], db_index=True, default=True, verbose_name='Parlamentar Titular'), |
|||
), |
|||
] |
|||
@ -0,0 +1,10 @@ |
|||
{% extends "crud/detail.html" %} |
|||
{% load i18n %} |
|||
{% block sub_actions %} |
|||
{{ block.super }} |
|||
{% if object.em_tramitacao %} |
|||
<div class="actions btn-group btn-group-sm" role="group"> |
|||
<a href="{% url 'sapl.materia:acompanhar_materia' object.id %}" class="btn btn-default">Acompanhar Matéria</a> |
|||
</div> |
|||
{% endif %} |
|||
{% endblock sub_actions %} |
|||
Loading…
Reference in new issue