|
@ -1,5 +1,6 @@ |
|
|
from braces.views import FormMessagesMixin |
|
|
from braces.views import FormMessagesMixin |
|
|
from django.core.urlresolvers import reverse_lazy |
|
|
from django.core.urlresolvers import reverse_lazy |
|
|
|
|
|
from django.utils.translation import ugettext as _ |
|
|
from django.views.generic import ( |
|
|
from django.views.generic import ( |
|
|
CreateView, DeleteView, ListView, UpdateView, DetailView) |
|
|
CreateView, DeleteView, ListView, UpdateView, DetailView) |
|
|
|
|
|
|
|
@ -7,20 +8,31 @@ from .forms import ComissaoForm |
|
|
from .models import Comissao |
|
|
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 |
|
|
model = Comissao |
|
|
|
|
|
title = Comissao._meta.verbose_name_plural |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComissaoDetailView(DetailView): |
|
|
class ComissaoDetailView(BaseMixin, DetailView): |
|
|
model = Comissao |
|
|
model = Comissao |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComissaoCreateView(CreateView): |
|
|
class ComissaoCreateView(BaseMixin, CreateView): |
|
|
model = Comissao |
|
|
model = Comissao |
|
|
success_url = reverse_lazy('comissao_list') |
|
|
success_url = reverse_lazy('comissao_list') |
|
|
|
|
|
title = _('Nova Comissão') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComissaoUpdateView(FormMessagesMixin, UpdateView): |
|
|
class ComissaoUpdateView(BaseMixin, FormMessagesMixin, UpdateView): |
|
|
model = Comissao |
|
|
model = Comissao |
|
|
form_class = ComissaoForm |
|
|
form_class = ComissaoForm |
|
|
success_url = reverse_lazy('comissao_list') |
|
|
success_url = reverse_lazy('comissao_list') |
|
@ -30,6 +42,6 @@ class ComissaoUpdateView(FormMessagesMixin, UpdateView): |
|
|
return u"{0} updated successfully!".format(self.object) |
|
|
return u"{0} updated successfully!".format(self.object) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComissaoDeleteView(DeleteView): |
|
|
class ComissaoDeleteView(BaseMixin, DeleteView): |
|
|
model = Comissao |
|
|
model = Comissao |
|
|
success_url = reverse_lazy('comissao_list') |
|
|
success_url = reverse_lazy('comissao_list') |
|
|