diff --git a/comissoes/views.py b/comissoes/views.py index 0611e3863..7891a4c95 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -1,5 +1,6 @@ from braces.views import FormMessagesMixin from django.core.urlresolvers import reverse_lazy +from django.utils.translation import ugettext as _ from django.views.generic import ( CreateView, DeleteView, ListView, UpdateView, DetailView) @@ -7,20 +8,31 @@ from .forms import ComissaoForm from .models import Comissao -class ComissaoListView(ListView): +class BaseMixin(object): + + @property + def title(self): + return self.get_object() + + help_url = '/comissoes/ajuda' + + +class ComissaoListView(BaseMixin, ListView): model = Comissao + title = Comissao._meta.verbose_name_plural -class ComissaoDetailView(DetailView): +class ComissaoDetailView(BaseMixin, DetailView): model = Comissao -class ComissaoCreateView(CreateView): +class ComissaoCreateView(BaseMixin, CreateView): model = Comissao success_url = reverse_lazy('comissao_list') + title = _('Nova Comissão') -class ComissaoUpdateView(FormMessagesMixin, UpdateView): +class ComissaoUpdateView(BaseMixin, FormMessagesMixin, UpdateView): model = Comissao form_class = ComissaoForm success_url = reverse_lazy('comissao_list') @@ -30,6 +42,6 @@ class ComissaoUpdateView(FormMessagesMixin, UpdateView): return u"{0} updated successfully!".format(self.object) -class ComissaoDeleteView(DeleteView): +class ComissaoDeleteView(BaseMixin, DeleteView): model = Comissao success_url = reverse_lazy('comissao_list') diff --git a/templates/base.html b/templates/base.html index 5816cfbe1..4de008e05 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,7 +7,7 @@
Comissões
Incluir Comissão