Browse Source

Fix #147

pull/153/head
Edward Ribeiro 9 years ago
parent
commit
c85533bc77
  1. 12
      protocoloadm/views.py
  2. 5
      templates/protocoloadm/anular_protocoloadm.html

12
protocoloadm/views.py

@ -2,7 +2,7 @@ from datetime import date, datetime
from re import sub from re import sub
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, Field, Fieldset, Layout, Submit from crispy_forms.layout import ButtonHolder, HTML, Field, Fieldset, Layout, Submit
from django import forms from django import forms
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
@ -326,7 +326,12 @@ class AnularProcoloAdmForm(forms.Form):
self.helper = FormHelper() self.helper = FormHelper()
self.helper.layout = Layout( self.helper.layout = Layout(
Fieldset('Identificação do Protocolo', Fieldset('Identificação do Protocolo',
row1, row2) row1,
row2,
HTML(" "),
ButtonHolder(Submit('submit', 'Anular',
css_class='button primary'))
)
) )
super(AnularProcoloAdmForm, self).__init__( super(AnularProcoloAdmForm, self).__init__(
*args, **kwargs) *args, **kwargs)
@ -361,7 +366,8 @@ class AnularProtocoloAdmView(FormMixin, GenericView):
ano = request.POST['ano_protocolo'] ano = request.POST['ano_protocolo']
justificativa_anulacao = sub(' ', ' ', strip_tags( justificativa_anulacao = sub(' ', ' ', strip_tags(
request.POST['justificativa_anulacao'])) request.POST['justificativa_anulacao']))
user_anulacao = "NOUSER" # TODO get user from session
user_anulacao = request.user.username
ip_addr = get_client_ip(request) ip_addr = get_client_ip(request)
try: try:

5
templates/protocoloadm/anular_protocoloadm.html

@ -3,10 +3,5 @@
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block detail_content %} {% block detail_content %}
<div>{{ message }} </div> <div>{{ message }} </div>
<form method="POST">
{% csrf_token %}
{% crispy form %} {% crispy form %}
</br>
<input type="submit" value="Anular" class="button primary" />
</form>
{% endblock detail_content %} {% endblock detail_content %}
Loading…
Cancel
Save