mirror of
https://github.com/ae-utbm/sith.git
synced 2026-05-13 12:38:09 +00:00
add club links to club list page
This commit is contained in:
@@ -69,6 +69,18 @@
|
||||
{{ club.name }} {% if not club.is_active %}({% trans %}inactive{% endtrans %}){% endif %}
|
||||
</h4>
|
||||
</a>
|
||||
{% set links = club.links.all() %}
|
||||
{% if links %}
|
||||
<br>
|
||||
<div class="row gap-2x">
|
||||
{% for link in club.links.all() %}
|
||||
<a href="{{ link.url }}">
|
||||
<i class="{{ link.link_type.icon }} fa-xl"></i>
|
||||
<strong>{{ link.name }}</strong>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ club.short_description|markdown }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-3
@@ -32,7 +32,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMix
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.core.exceptions import NON_FIELD_ERRORS, PermissionDenied, ValidationError
|
||||
from django.core.paginator import InvalidPage, Paginator
|
||||
from django.db.models import F, Q, Sum
|
||||
from django.db.models import F, Prefetch, Q, Sum
|
||||
from django.db.models.functions import Length
|
||||
from django.http import Http404, StreamingHttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
@@ -61,7 +61,14 @@ from club.forms import (
|
||||
MailingForm,
|
||||
SellingsForm,
|
||||
)
|
||||
from club.models import Club, LinkType, Mailing, MailingSubscription, Membership
|
||||
from club.models import (
|
||||
Club,
|
||||
ClubLink,
|
||||
LinkType,
|
||||
Mailing,
|
||||
MailingSubscription,
|
||||
Membership,
|
||||
)
|
||||
from com.models import Poster
|
||||
from com.views import (
|
||||
PosterCreateBaseView,
|
||||
@@ -205,7 +212,9 @@ class ClubListView(AllowFragment, FormMixin, ListView):
|
||||
|
||||
template_name = "club/club_list.jinja"
|
||||
form_class = ClubSearchForm
|
||||
queryset = Club.objects.order_by("name")
|
||||
queryset = Club.objects.prefetch_related(
|
||||
Prefetch("links", queryset=ClubLink.objects.select_related("link_type"))
|
||||
).order_by("name")
|
||||
paginate_by = 20
|
||||
|
||||
def get_form_kwargs(self):
|
||||
|
||||
Reference in New Issue
Block a user