Browse Source

Resolve detalhes em Casa Legislativa Fix #487

pull/520/head
Eduardo Calil 9 years ago
parent
commit
140cf02f05
  1. 19
      sapl/base/migrations/0016_auto_20160701_0940.py
  2. 6
      sapl/base/models.py
  3. 13
      sapl/base/views.py

19
sapl/base/migrations/0016_auto_20160701_0940.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-07-01 12:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0015_problemamigracao_nome_campo'),
]
operations = [
migrations.AlterModelOptions(
name='casalegislativa',
options={'verbose_name': 'Casa Legislativa', 'verbose_name_plural': 'Casa Legislativa'},
),
]

6
sapl/base/models.py

@ -46,7 +46,11 @@ class CasaLegislativa(models.Model):
class Meta:
verbose_name = _('Casa Legislativa')
verbose_name_plural = _('Casas Legislativas')
verbose_name_plural = _('Casa Legislativa')
def __str__(self):
return _('Casa Legislativa de %(municipio)s') % {
'municipio': self.municipio}
class ProblemaMigracao(models.Model):

13
sapl/base/views.py

@ -1,6 +1,9 @@
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateView
from sapl.crud.base import Crud, CrudBaseMixin, CrudCreateView, CrudUpdateView
from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudDetailView, CrudUpdateView)
from .forms import CasaLegislativaForm
from .models import CasaLegislativa
@ -23,6 +26,14 @@ class CasaLegislativaCrud(Crud):
class UpdateView(CrudUpdateView):
form_class = CasaLegislativaForm
class DetailView(CrudDetailView):
form_class = CasaLegislativaForm
def get(self, request, *args, **kwargs):
return HttpResponseRedirect(
reverse('sapl.base:casalegislativa_update',
kwargs={'pk': self.kwargs['pk']}))
class HelpView(TemplateView):
# XXX treat non existing template as a 404!!!!

Loading…
Cancel
Save