Skip to content

Commit

Permalink
feat(Besoins): Admin: afficher la liste des structures intéressées
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Mar 18, 2024
1 parent b0fb1c9 commit 29cfb84
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion lemarche/tenders/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,34 @@ class TenderQuestionInline(admin.TabularInline):
extra = 0


class TenderSiaeInterestedInline(admin.TabularInline):
model = TenderSiae
verbose_name = "Structure intéressée"
verbose_name_plural = "Structures intéressées"
fields = [
"id",
"siae",
"source",
"found_with_ai",
"detail_contact_click_date",
"survey_transactioned_send_date",
"survey_transactioned_answer",
]
readonly_fields = [field.name for field in TenderSiae._meta.fields]
extra = 0
show_change_link = True
can_delete = False
classes = ["collapse"]

def has_add_permission(self, request, obj=None):
return False

def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.filter(detail_contact_click_date__isnull=False)
return qs


class TenderForm(forms.ModelForm):
class Meta:
model = Tender
Expand Down Expand Up @@ -334,6 +362,7 @@ class TenderAdmin(FieldsetsInlineMixin, admin.ModelAdmin):
)
},
),
TenderSiaeInterestedInline,
(
"Transaction ?",
{
Expand Down Expand Up @@ -383,7 +412,7 @@ class TenderAdmin(FieldsetsInlineMixin, admin.ModelAdmin):
def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.select_related("author")
qs = qs.with_siae_stats()
# qs = qs.with_siae_stats()
# qs = qs.with_question_stats() # doesn't work when chaining these 2 querysets: adds duplicates...
return qs

Expand Down

0 comments on commit 29cfb84

Please sign in to comment.