mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-10-31 07:49:57 +01:00 
			
		
		
		
	Club list is now clickable
This commit is contained in:
		| @@ -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 %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user