mirror of
https://github.com/ae-utbm/sith.git
synced 2026-05-14 04:58:06 +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 %}
|
{{ club.name }} {% if not club.is_active %}({% trans %}inactive{% endtrans %}){% endif %}
|
||||||
</h4>
|
</h4>
|
||||||
</a>
|
</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 }}
|
{{ club.short_description|markdown }}
|
||||||
</div>
|
</div>
|
||||||
</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.contrib.messages.views import SuccessMessageMixin
|
||||||
from django.core.exceptions import NON_FIELD_ERRORS, PermissionDenied, ValidationError
|
from django.core.exceptions import NON_FIELD_ERRORS, PermissionDenied, ValidationError
|
||||||
from django.core.paginator import InvalidPage, Paginator
|
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.db.models.functions import Length
|
||||||
from django.http import Http404, StreamingHttpResponse
|
from django.http import Http404, StreamingHttpResponse
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
@@ -61,7 +61,14 @@ from club.forms import (
|
|||||||
MailingForm,
|
MailingForm,
|
||||||
SellingsForm,
|
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.models import Poster
|
||||||
from com.views import (
|
from com.views import (
|
||||||
PosterCreateBaseView,
|
PosterCreateBaseView,
|
||||||
@@ -205,7 +212,9 @@ class ClubListView(AllowFragment, FormMixin, ListView):
|
|||||||
|
|
||||||
template_name = "club/club_list.jinja"
|
template_name = "club/club_list.jinja"
|
||||||
form_class = ClubSearchForm
|
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
|
paginate_by = 20
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user