From f055a1902a1fcffef44aa9701ba8f812af2027ed Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Mon, 18 Sep 2023 17:37:50 +0200 Subject: [PATCH] add button in siae detail --- lemarche/templates/tenders/detail.html | 4 ++++ lemarche/www/tenders/views.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index 927bdf45d..4a349e62b 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -102,6 +102,10 @@ {{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }} + + + {{ 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 + {{ 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 }} diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index 9a11488ab..345a95ad9 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -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 @@ -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)