From dd79df49fed7565647db66ecf2f179ece91f0864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LeandroJata=C3=AD?= Date: Fri, 12 Jul 2024 17:02:06 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20impl=20altera=C3=A7=C3=A3o=20de=20nomen?= =?UTF-8?q?clatura=20e=20ref=20listagem=20da=20pesquisa=20de=20normas=20(#?= =?UTF-8?q?3726)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: impl alteração de nomenclatura e ref listagem dos resultados de normas --- sapl/norma/forms.py | 2 +- .../migrations/0045_auto_20240711_1405.py | 46 +++++++++++ sapl/norma/models.py | 13 ++- .../templates/norma/normajuridica_filter.html | 82 +++++++++++-------- 4 files changed, 107 insertions(+), 36 deletions(-) create mode 100644 sapl/norma/migrations/0045_auto_20240711_1405.py diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index 026d49842..53f88c141 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -264,7 +264,7 @@ class NormaJuridicaForm(FileFieldCheckMixin, ModelForm): texto_integral = self.cleaned_data.get('texto_integral', False) if texto_integral: - validar_arquivo(texto_integral, "Texto Integral") + validar_arquivo(texto_integral, "Texto Original") return texto_integral diff --git a/sapl/norma/migrations/0045_auto_20240711_1405.py b/sapl/norma/migrations/0045_auto_20240711_1405.py new file mode 100644 index 000000000..fbee141ea --- /dev/null +++ b/sapl/norma/migrations/0045_auto_20240711_1405.py @@ -0,0 +1,46 @@ +# Generated by Django 2.2.28 on 2024-07-11 17:05 + +from django.db import migrations, models +import sapl.norma.models +import sapl.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0044_auto_20230529_1641'), + ] + + operations = [ + migrations.AlterField( + model_name='anexonormajuridica', + name='ano', + field=models.PositiveSmallIntegerField(choices=[(2025, 2025), (2024, 2024), (2023, 2023), (2022, 2022), (2021, 2021), (2020, 2020), (2019, 2019), (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'), + ), + migrations.AlterField( + model_name='normaestatisticas', + name='ano', + field=models.PositiveSmallIntegerField(choices=[(2025, 2025), (2024, 2024), (2023, 2023), (2022, 2022), (2021, 2021), (2020, 2020), (2019, 2019), (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)], default=sapl.norma.models.get_ano_atual, verbose_name='Ano'), + ), + migrations.AlterField( + model_name='normajuridica', + name='ano', + field=models.PositiveSmallIntegerField(choices=[(2025, 2025), (2024, 2024), (2023, 2023), (2022, 2022), (2021, 2021), (2020, 2020), (2019, 2019), (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'), + ), + migrations.AlterField( + model_name='normajuridica', + name='texto_integral', + field=models.FileField(blank=True, + max_length=300, + null=True, + storage=sapl.utils.OverwriteStorage(), + upload_to=sapl.norma.models.norma_upload_path, + validators=[ + sapl.utils.restringe_tipos_de_arquivo_txt + ], + verbose_name='Texto Original'), + ), + ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index 3e33d11ba..cd8a81745 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -138,7 +138,7 @@ class NormaJuridica(models.Model): blank=True, null=True, upload_to=norma_upload_path, - verbose_name=_('Texto Integral'), + verbose_name=_('Texto Original'), storage=OverwriteStorage(), validators=[restringe_tipos_de_arquivo_txt]) tipo = models.ForeignKey( @@ -259,6 +259,17 @@ class NormaJuridica(models.Model): def epigrafe(self): return self.__str__() + @property + def epigrafe_simplificada(self): + numero_norma = self.numero + if numero_norma.isnumeric(): + numero_norma = '{0:,}'.format(int(self.numero)).replace(',', '.') + + return _('%(tipo)s nº %(numero)s, de %(data)s') % { + 'tipo': self.tipo, + 'numero': numero_norma, + 'data': defaultfilters.date(self.data, "d \d\e F \d\e Y").lower()} + def delete(self, using=None, keep_parents=False): texto_integral = self.texto_integral result = super().delete(using=using, keep_parents=keep_parents) diff --git a/sapl/templates/norma/normajuridica_filter.html b/sapl/templates/norma/normajuridica_filter.html index d317f7bd6..33f0b8993 100644 --- a/sapl/templates/norma/normajuridica_filter.html +++ b/sapl/templates/norma/normajuridica_filter.html @@ -45,49 +45,63 @@ {% endif %}
- + - - - - - + {% for n in page_obj %} - - {% if n.texto_integral %} - - {% else %} - - {% endif %} - - - +
TipoNúmeroAnoDataEmentaNormas Jurídicas Relacionamentos
{{n.tipo}}{{n.numero}}{{n.numero}}{{n.ano}}{{n.data}}{{n.ementa|safe}} - {% if n.get_normas_relacionadas.0|length == 0 and n.get_normas_relacionadas.1|length == 0%} - Norma sem alterações posteriores. - {% else %} - {% for p in n.get_normas_relacionadas.0 %} -
- {{ p.tipo_vinculo.descricao_ativa }}  - - {{ p.norma_relacionada }} - -
- {% endfor %} - {% for r in n.get_normas_relacionadas.1 %} -
- {{ r.tipo_vinculo.descricao_passiva }}  - - {{ r.norma_principal }} - -
- {% endfor %} + + {{n.epigrafe_simplificada}} +
+ {% if n.orgao %} + Órgão: {{n.orgao}}
+ {% endif %} + + Ementa:
+ {{n.ementa|safe}}
+ + {% if n.texto_articulado.exists %} + + + Texto Multivigente + + {% if n.texto_integral %} | {% endif %} + {% endif %} + {% if n.texto_integral %} + + + Texto Original + +
{% endif %}
+ {% if n.get_normas_relacionadas.0|length == 0 and n.get_normas_relacionadas.1|length == 0%} + + Norma sem alterações posteriores. + + {% else %} + {% for p in n.get_normas_relacionadas.0 %} +
+ {{ p.tipo_vinculo.descricao_ativa }}  + + {{ p.norma_relacionada }} + +
+ {% endfor %} + {% for r in n.get_normas_relacionadas.1 %} +
+ {{ r.tipo_vinculo.descricao_passiva }}  + + {{ r.norma_principal }} + +
+ {% endfor %} + {% endif %} {% if n.autoria_set.all %} Autor: {% for a in n.autoria_set.all %}