Fix tab mixin on clubs

This commit is contained in:
Antoine Bartuccio 2017-12-05 15:53:36 +01:00
parent 91d3e9e4dc
commit cc99cecaa0
Signed by: klmp200
GPG Key ID: E7245548C53F904B
3 changed files with 6 additions and 6 deletions

View File

@ -90,8 +90,6 @@ class ClubTabsMixin(TabedViewMixin):
def get_tabs_title(self): def get_tabs_title(self):
if isinstance(self.object, PageRev): if isinstance(self.object, PageRev):
self.object = self.object.page.club self.object = self.object.page.club
if isinstance(self.object, Poster):
self.object = self.club
return self.object.get_display_name() return self.object.get_display_name()
def get_list_of_tabs(self): def get_list_of_tabs(self):
@ -603,15 +601,17 @@ class MailingAutoCleanView(View):
return redirect('club:mailing', club_id=self.mailing.club.id) return redirect('club:mailing', club_id=self.mailing.club.id)
class PosterListView(PosterListBaseView, CanViewMixin, ClubTabsMixin): class PosterListView(PosterListBaseView, ClubTabsMixin, CanViewMixin):
"""List communication posters""" """List communication posters"""
def dispatch(self, request, *args, **kwargs): def get_object(self):
return super(PosterListView, self).dispatch(request, *args, **kwargs) return self.club
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs) kwargs = super(PosterListView, self).get_context_data(**kwargs)
kwargs['app'] = "club" kwargs['app'] = "club"
kwargs['tabs_title'] = self.get_tabs_title()
kwargs['list_of_tabs'] = self.get_list_of_tabs()
return kwargs return kwargs

View File

@ -510,6 +510,7 @@ class PosterListBaseView(ListView):
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
club_id = kwargs.pop('club_id', None) club_id = kwargs.pop('club_id', None)
self.club = None
if club_id: if club_id:
self.club = get_object_or_404(Club, pk=club_id) self.club = get_object_or_404(Club, pk=club_id)
return super(PosterListBaseView, self).dispatch(request, *args, **kwargs) return super(PosterListBaseView, self).dispatch(request, *args, **kwargs)

View File

@ -169,7 +169,6 @@
</ul> </ul>
<div id="content"> <div id="content">
{{ object }}
{% if list_of_tabs %} {% if list_of_tabs %}
<div class="tool_bar"> <div class="tool_bar">
<div>{{ tabs_title }}</div> <div>{{ tabs_title }}</div>