Skip to content

Commit

Permalink
add button in siae detail
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Sep 18, 2023
1 parent ef54627 commit f055a19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
<i class="ri-focus-2-line"></i>
{{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }}
</a>
<a href="{% url 'tenders:detail-siae-list' tender.slug "VIEW" %}" id="show-tender-siae-list-from-detail-btn" class="btn btn-primary mb-3">
<i class="ri-focus-2-line"></i>
{{ tender.siae_detail_display_date_count_all }} prestataire{{ tender.siae_email_send_date_count|pluralize }} qui {{ tender.siae_email_send_date_count|pluralize:'a,ont' }} vu
</a>
<a href="{% url 'tenders:detail-siae-list' tender.slug "INTERESTED" %}" id="show-tender-siae-interested-list-from-detail-btn" class="btn btn-primary mb-3">
<i class="ri-thumb-up-line"></i>
{{ tender.siae_detail_contact_click_date_count }} prestataire{{ tender.siae_detail_contact_click_date_count|pluralize }} intéressé{{ tender.siae_detail_contact_click_date_count|pluralize }}
Expand Down
10 changes: 8 additions & 2 deletions lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator
from django.db.models import Prefetch
from django.db.models import Prefetch, Q
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse_lazy
Expand Down Expand Up @@ -418,7 +418,13 @@ def get_queryset(self):
qs = qs.filter(tendersiae__tender=self.tender, tendersiae__detail_contact_click_date__isnull=False)
qs = qs.order_by("-tendersiae__detail_contact_click_date")
elif self.status == "VIEW": # status == "INTERESTED"
qs = qs.filter(tendersiae__tender=self.tender, tendersiae__email_link_click_date__isnull=False)
qs = qs.filter(
Q(tendersiae__tender=self.tender)
& (
Q(tendersiae__email_link_click_date__isnull=False)
| Q(tendersiae__detail_display_date__isnull=False)
)
).distinct()
qs = qs.order_by("-tendersiae__email_link_click_date")
else: # default
qs = qs.filter(tendersiae__tender=self.tender, tendersiae__email_send_date__isnull=False)
Expand Down

0 comments on commit f055a19

Please sign in to comment.