From e1431870d4482500f63f31c4f1e878a77a2a54ee Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Thu, 15 Aug 2019 21:49:32 +0200 Subject: [PATCH] Club list is now clickable --- apps/member/models.py | 4 ++-- apps/member/views.py | 6 +++--- templates/member/club_list.html | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/apps/member/models.py b/apps/member/models.py index 70f8ccf7..10a51395 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -7,7 +7,7 @@ from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from django.utils.translation import gettext_lazy as _ -from django.urls import reverse +from django.urls import reverse, reverse_lazy class Profile(models.Model): """ @@ -96,7 +96,7 @@ class Club(models.Model): return self.name def get_absolute_url(self): - return reverse('member:club_detail', args=(self.pk,)) + return reverse_lazy('member:club_detail', args=(self.pk,)) class Role(models.Model): diff --git a/apps/member/views.py b/apps/member/views.py index 6408dc5f..4c0900ab 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -54,12 +54,12 @@ class ClubCreateView(LoginRequiredMixin,CreateView): def form_valid(self,form): return super().form_valid(form) -class ClubListView(LoginRequiredMixin,ListView): +class ClubListView(LoginRequiredMixin,SingleTableView): """ - List TransactionsTemplates + List existing tables """ model = Club - form_class = ClubForm + table_class = ClubTable class ClubDetailView(LoginRequiredMixin,DetailView): model = Club diff --git a/templates/member/club_list.html b/templates/member/club_list.html index dc1608f2..88b2489e 100644 --- a/templates/member/club_list.html +++ b/templates/member/club_list.html @@ -2,7 +2,20 @@ {% load render_table from django_tables2 %} {% block content %} -{% render_table object_list %} +{% render_table table %} New Club + +{% endblock %} +{% block javascript %} +{{ block.super }} + {% endblock %}