Commit e1431870 authored by Pierre-antoine Comby's avatar Pierre-antoine Comby

Club list is now clickable

parent 40c697e5
......@@ -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):
......
......@@ -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
......
......@@ -2,7 +2,20 @@
{% load render_table from django_tables2 %}
{% block content %}
{% render_table object_list %}
{% render_table table %}
<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 %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment