Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Besoins): Admin: afficher la liste des structures intéressées #1131

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions 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
14 changes: 10 additions & 4 deletions lemarche/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,21 +929,27 @@ def setUp(cls):
"location": cls.perimeter_paris.pk,
"perimeters": [cls.perimeter_paris.pk],
"sectors": [sector.id for sector in cls.sectors[1:8]],
"initial-response_kind": "TEL",
"initial-presta_type": "BUILD",
"notes-note-content_type-object_id-TOTAL_FORMS": "0",
"notes-note-content_type-object_id-INITIAL_FORMS": "0",
"notes-note-content_type-object_id-MIN_NUM_FORMS": "0",
"notes-note-content_type-object_id-MAX_NUM_FORMS": "1000",
"notes-note-content_type-object_id-__prefix__-id": "",
"notes-note-content_type-object_id-__prefix__-text": "",
"questions-TOTAL_FORMS": "0",
"questions-INITIAL_FORMS": "0",
"questions-__prefix__-id": "",
"initial-response_kind": "TEL",
"questions-MIN_NUM_FORMS": "0",
"questions-MAX_NUM_FORMS": "1000",
"initial-presta_type": "BUILD",
"questions-TOTAL_FORMS": "0",
"questions-__prefix__-id": "",
"questions-__prefix__-text": "",
"questions-__prefix__-tender": cls.tender.pk,
"tendersiae_set-TOTAL_FORMS": "0",
"tendersiae_set-INITIAL_FORMS": "0",
"tendersiae_set-MIN_NUM_FORMS": "0",
"tendersiae_set-MAX_NUM_FORMS": "1000",
"tendersiae_set-__prefix__-id": "",
"tendersiae_set-__prefix__-text": "",
}
for key, value in cls.form_data.items():
if value is None:
Expand Down
Loading