Browse Source

Merge branch '3.1.x' into feat/melhorias-pntp-oficio-017

feat/melhorias-pntp-oficio-017
Edward 1 day ago
committed by GitHub
parent
commit
c16200b30f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      sapl/audiencia/forms.py
  2. 6
      sapl/relatorios/forms.py
  3. 9
      sapl/relatorios/views.py
  4. 14
      sapl/templates/relatorios/RelatorioMateriasPorAutor_filter.html
  5. 8
      sapl/templates/relatorios/RelatorioNormasPorAutor_filter.html
  6. 2
      sapl/templates/relatorios/blocos_sessao_plenaria/ocorrencias_da_sessao.html
  7. 5
      sapl/utils.py

2
sapl/audiencia/forms.py

@ -115,7 +115,7 @@ class AudienciaForm(FileFieldCheckMixin, forms.ModelForm):
numero=materia,
ano=ano_materia,
tipo=tipo_materia)
except ObjectDoesNotExist:
except (ObjectDoesNotExist, ValueError):
msg = _('A matéria %s%s/%s não existe no cadastro'
' de matérias legislativas.' % (tipo_materia, materia, ano_materia))
self.logger.warning(

6
sapl/relatorios/forms.py

@ -633,6 +633,8 @@ class RelatorioMateriasPorAutorFilterSet(django_filters.FilterSet):
@property
def qs(self):
parent = super().qs
if not self.data.get('autoria__autor'):
return parent.none()
return parent.distinct().order_by('-ano', '-numero', 'tipo', 'autoria__autor', '-autoria__primeiro_autor')
class Meta(FilterOverridesMetaMixin):
@ -744,7 +746,9 @@ class RelatorioNormasPorAutorFilterSet(django_filters.FilterSet):
@property
def qs(self):
parent = super().qs
return parent.distinct().filter(autorianorma__primeiro_autor=True) \
if not self.data.get('autorianorma__autor'):
return parent.none()
return parent.distinct() \
.order_by('autorianorma__autor', '-autorianorma__primeiro_autor', 'tipo', '-ano', '-numero')
class Meta(FilterOverridesMetaMixin):

9
sapl/relatorios/views.py

@ -2660,7 +2660,6 @@ class RelatorioMateriasPorAutorView(RelatorioMixin, FilterView):
return context
qs = context['object_list']
context['materias_resultado'] = list(collections.OrderedDict.fromkeys(qs))
context['qtdes'] = num_materias_por_tipo(qs)
qr = self.request.GET.copy()
@ -2675,9 +2674,9 @@ class RelatorioMateriasPorAutorView(RelatorioMixin, FilterView):
context['tipo'] = ''
if self.request.GET['autoria__autor']:
autor = int(self.request.GET['autoria__autor'])
context['autor'] = (str(Autor.objects.get(id=autor)))
context['autor'] = Autor.objects.get(id=autor)
else:
context['autor'] = ''
context['autor'] = None
context['periodo'] = (
self.request.GET['data_apresentacao_0'] +
' - ' + self.request.GET['data_apresentacao_1'])
@ -2921,9 +2920,9 @@ class RelatorioNormasPorAutorView(RelatorioMixin, FilterView):
if self.request.GET['autorianorma__autor']:
autor = int(self.request.GET['autorianorma__autor'])
context['autor'] = (str(Autor.objects.get(id=autor)))
context['autor'] = Autor.objects.get(id=autor)
else:
context['autor'] = ''
context['autor'] = None
context['periodo'] = (
self.request.GET['data_0'] +
' - ' + self.request.GET['data_1'])

14
sapl/templates/relatorios/RelatorioMateriasPorAutor_filter.html

@ -17,7 +17,7 @@
&emsp;Tipo de matéria: {{ tipo }}<br />
&emsp;Data de apresentação: {{ periodo }}<br /><br /><br/>
{% if materias_resultado %}
{% if object_list %}
<table class="table table-bordered table-hover">
<thead class="thead-default" >
<tr class="active">
@ -43,10 +43,10 @@
<tr class="active">
<th width="10%">Matéria</th>
<th>Ementa</th>
<th width="20%">Autor(es)</th>
<th width="20%">Coautor(es)</th>
</tr>
</thead>
{% for materia in materias_resultado %}
{% for materia in object_list %}
<tbody>
<tr>
<td>
@ -56,11 +56,9 @@
</td>
<td>{% autoescape off %}{{materia.ementa}}<br>{{materia.observacao}}{% endautoescape %}</td>
<td>
{% for autor in materia.autoria_set.all %}
{% if not autor.primeiro_autor %}
{{ autor.autor }}<br />
{% else %}
<u><b><i>{{ autor.autor }}</i></b></u><br />
{% for autoria in materia.autoria_set.all %}
{% if autoria.autor != autor %}
{{ autoria.autor }}<br />
{% endif %}
{% endfor %}
</td>

8
sapl/templates/relatorios/RelatorioNormasPorAutor_filter.html

@ -54,13 +54,11 @@
</a></td>
<td>{% autoescape off %}{{norma.ementa}}<br>{{norma.observacao}}{% endautoescape %}</td>
<td>
{% if norma.autorianorma_set.first != norma.autorianorma_set.last %}
{% for autor in norma.autorianorma_set.all %}
{% if not autor.primeiro_autor %}
{{ autor.autor }}<br />
{% for autoria in norma.autorianorma_set.all %}
{% if autoria.autor != autor %}
{{ autoria.autor }}<br />
{% endif %}
{% endfor %}
{% endif %}
</td>
</tr>
</tbody>

2
sapl/templates/relatorios/blocos_sessao_plenaria/ocorrencias_da_sessao.html

@ -1,4 +1,4 @@
<h2 class="gray-title">Ocorrências da Sessão</h2>
{% for o in lst_ocorrencias%}
<p>{{o|striptags|safe}}</p>
<p>{{o.conteudo|striptags|safe}}</p>
{% endfor %}

5
sapl/utils.py

@ -1404,8 +1404,9 @@ class MultiFormatOutputMixin:
return {fmt: fields for fmt in self.formats_impl}
def render_to_response(self, context, **response_kwargs):
format_result = getattr(self.request, self.request.method).get(
'format', None)
# HEAD shares query params with GET; Django has no request.HEAD attribute.
_method = 'GET' if self.request.method == 'HEAD' else self.request.method
format_result = getattr(self.request, _method).get('format', None)
if format_result:
if format_result not in self.formats_impl:

Loading…
Cancel
Save