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

[Utilisateurs] Renommer les choix des types d'acheteurs #983

Merged
merged 2 commits into from
Nov 23, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.2 on 2023-11-20 15:47

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("users", "0030_user_sectors"),
]

operations = [
migrations.AlterField(
model_name="user",
name="buyer_kind_detail",
field=models.CharField(
blank=True,
choices=[
("PRIVATE_BIG_CORP", "Grand groupe (+5000 salariés)"),
("PRIVATE_ETI", "ETI (+250 salariés)"),
("PRIVATE_PME", "PME (+10 salariés)"),
("PRIVATE_TPE", "TPE"),
("PUBLIC_ASSOCIATION", "Association"),
("PUBLIC_COLLECTIVITY", "Collectivité"),
("PUBLIC_ESTABLISHMENT", "Établissement public"),
("PUBLIC_MINISTRY", "Ministère"),
],
max_length=20,
verbose_name="Type d'acheteur (détail)",
),
),
]
27 changes: 14 additions & 13 deletions lemarche/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,23 @@ class User(AbstractUser):
(BUYER_KIND_PUBLIC, "Public"),
(BUYER_KIND_PRIVATE, "Privé"),
)
BUYER_KIND_DETAIL_PUBLIC_MINISTRY = "PUBLIC_MINISTRY"
BUYER_KIND_DETAIL_PUBLIC_ESTABLISHMENT = "PUBLIC_ESTABLISHMENT"
BUYER_KIND_DETAIL_PUBLIC_COLLECTIVITY = "PUBLIC_COLLECTIVITY"
BUYER_KIND_DETAIL_PUBLIC_ASSOCIATION = "PUBLIC_ASSOCIATION"
BUYER_KIND_DETAIL_PRIVATE_BIG_CORP = "PRIVATE_BIG_CORP"
BUYER_KIND_DETAIL_PRIVATE_ETI = "PRIVATE_ETI"
BUYER_KIND_DETAIL_PRIVATE_PME = "PRIVATE_PME"
BUYER_KIND_DETAIL_PRIVATE_TPE = "PRIVATE_TPE"
BUYER_KIND_DETAIL_PUBLIC_ASSOCIATION = "PUBLIC_ASSOCIATION"
BUYER_KIND_DETAIL_PUBLIC_COLLECTIVITY = "PUBLIC_COLLECTIVITY"
BUYER_KIND_DETAIL_PUBLIC_ESTABLISHMENT = "PUBLIC_ESTABLISHMENT"
BUYER_KIND_DETAIL_PUBLIC_MINISTRY = "PUBLIC_MINISTRY"
BUYER_KIND_DETAIL_CHOICES = (
(BUYER_KIND_DETAIL_PUBLIC_MINISTRY, "Public : Ministère"),
(BUYER_KIND_DETAIL_PUBLIC_ESTABLISHMENT, "Public : Établissement public"),
(BUYER_KIND_DETAIL_PUBLIC_COLLECTIVITY, "Public : Collectivité"),
(BUYER_KIND_DETAIL_PUBLIC_ASSOCIATION, "Public : Association"),
(BUYER_KIND_DETAIL_PRIVATE_BIG_CORP, "Privé : Grand groupe"),
(BUYER_KIND_DETAIL_PRIVATE_ETI, "Privé : ETI"),
(BUYER_KIND_DETAIL_PRIVATE_PME, "Privé : PME"),
(BUYER_KIND_DETAIL_PRIVATE_TPE, "Privé : TPE"),
(BUYER_KIND_DETAIL_PRIVATE_BIG_CORP, "Grand groupe (+5000 salariés)"),
(BUYER_KIND_DETAIL_PRIVATE_ETI, "ETI (+250 salariés)"),
(BUYER_KIND_DETAIL_PRIVATE_PME, "PME (+10 salariés)"),
(BUYER_KIND_DETAIL_PRIVATE_TPE, "TPE"),
(BUYER_KIND_DETAIL_PUBLIC_ASSOCIATION, "Association"),
(BUYER_KIND_DETAIL_PUBLIC_COLLECTIVITY, "Collectivité"),
(BUYER_KIND_DETAIL_PUBLIC_ESTABLISHMENT, "Établissement public"),
(BUYER_KIND_DETAIL_PUBLIC_MINISTRY, "Ministère"),
)

PARTNER_KIND_FACILITATOR = "FACILITATEUR"
Expand Down Expand Up @@ -376,7 +376,8 @@ def kind_detail_display(self):
if self.kind:
kind_detail_display_string += self.get_kind_display()
if self.buyer_kind_detail:
kind_detail_display_string += f" : {self.get_buyer_kind_detail_display()}"
# remove parenthesis suffix
kind_detail_display_string += f" : {self.get_buyer_kind_detail_display().split(' (', 1)[0]}"
elif self.partner_kind:
kind_detail_display_string += f" : {self.get_partner_kind_display()}"
return kind_detail_display_string
Expand Down
2 changes: 1 addition & 1 deletion lemarche/users/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_kind_detail_display(self):
self.assertEqual(user_buyer.kind_detail_display, "Acheteur")
self.assertEqual(user_partner.kind_detail_display, "Partenaire")
self.assertEqual(user_buyer_public.kind_detail_display, "Acheteur")
self.assertEqual(user_buyer_private_pme.kind_detail_display, "Acheteur : Privé : PME")
self.assertEqual(user_buyer_private_pme.kind_detail_display, "Acheteur : PME")
self.assertEqual(
user_partner_facilitator.kind_detail_display, "Partenaire : Facilitateur des clauses sociales"
)
Expand Down