Browse Source

Change error message in composicao

pull/202/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
5391403e91
  1. 11
      comissoes/views.py
  2. 4
      templates/comissoes/composicao.html

11
comissoes/views.py

@ -1,3 +1,4 @@
import sapl
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit
from django import forms from django import forms
@ -6,11 +7,9 @@ from django.core.urlresolvers import reverse
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from parlamentares.models import Filiacao from parlamentares.models import Filiacao
from sapl.crud import build_crud from sapl.crud import build_crud
from vanilla import GenericView
from .models import (CargoComissao, Comissao, Composicao, Participacao, from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao) Periodo, TipoComissao)
@ -204,7 +203,8 @@ class ComposicaoView(FormMixin, GenericView):
msg = '' msg = ''
else: else:
composicao_id = 0 composicao_id = 0
msg = 'Ainda não há composição nessa comissão.' msg = 'Ainda não há uma composição formada!'
messages.add_message(request, messages.INFO, msg)
return self.render_to_response({ return self.render_to_response({
'participacoes': participacoes, 'participacoes': participacoes,
@ -212,8 +212,7 @@ class ComposicaoView(FormMixin, GenericView):
'composicao_id': composicao_id, 'composicao_id': composicao_id,
'form': form, 'form': form,
'pk': self.kwargs['pk'], 'pk': self.kwargs['pk'],
'comissao': Comissao.objects.get(id=self.kwargs['pk']), 'comissao': Comissao.objects.get(id=self.kwargs['pk'])})
'error': msg})
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
form = ComposicaoForm(request.POST) form = ComposicaoForm(request.POST)

4
templates/comissoes/composicao.html

@ -5,9 +5,7 @@
<h2>Composição</h2> <h2>Composição</h2>
{% block detail_content %} {% block detail_content %}
{% if error %} {% if composicao_id != 0 %}
<h5 align="center"><font color="#FF0000">{{ error }}</font></h5>
{% else %}
<table> <table>
<tr> <tr>
<th>Nome</th> <th>Nome</th>

Loading…
Cancel
Save