Club list is now clickable

This commit is contained in:
Pierre-antoine Comby 2019-08-15 21:49:32 +02:00
parent 40c697e57f
commit e1431870d4
3 changed files with 19 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from django.db import models
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.urls import reverse from django.urls import reverse, reverse_lazy
class Profile(models.Model): class Profile(models.Model):
""" """
@ -96,7 +96,7 @@ class Club(models.Model):
return self.name return self.name
def get_absolute_url(self): 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): class Role(models.Model):

View File

@ -54,12 +54,12 @@ class ClubCreateView(LoginRequiredMixin,CreateView):
def form_valid(self,form): def form_valid(self,form):
return super().form_valid(form) return super().form_valid(form)
class ClubListView(LoginRequiredMixin,ListView): class ClubListView(LoginRequiredMixin,SingleTableView):
""" """
List TransactionsTemplates List existing tables
""" """
model = Club model = Club
form_class = ClubForm table_class = ClubTable
class ClubDetailView(LoginRequiredMixin,DetailView): class ClubDetailView(LoginRequiredMixin,DetailView):
model = Club model = Club

View File

@ -2,7 +2,20 @@
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block content %} {% block content %}
{% render_table object_list %} {% render_table table %}
<a class="btn btn-primary" href="{% url 'member:club_create' %}">New Club</a> <a class="btn btn-primary" href="{% url 'member:club_create' %}">New Club</a>
{% endblock %}
{% block javascript %}
{{ block.super }}
<script type="text/javascript">
$(document).ready(function($) {
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
});
</script>
{% endblock %} {% endblock %}