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): méthode pour dupliquer un besoin #1097

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

raphodn
Copy link
Contributor

@raphodn raphodn commented Feb 21, 2024

Quoi ?

Nouveau utils duplicate(tender)
Ajout de test

Pourquoi ?

Parfois demandé par un admin. En attendant de rajouter un bouton

@raphodn raphodn force-pushed the raphodn/tender-duplicate-helper branch from 4470298 to 613f5c1 Compare February 21, 2024 12:48
@raphodn raphodn force-pushed the raphodn/tender-duplicate-helper branch from 613f5c1 to 02351cc Compare February 21, 2024 12:56
Comment on lines 103 to 108
def duplicate(tender: Tender) -> Tender:
FIELDS_TO_REMOVE = (
["_state", "_django_version"]
+ ["id", "slug", "siae_transactioned", "extra_data", "import_raw_object"]
+ Tender.READONLY_FIELDS
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def duplicate(tender: Tender) -> Tender:
FIELDS_TO_REMOVE = (
["_state", "_django_version"]
+ ["id", "slug", "siae_transactioned", "extra_data", "import_raw_object"]
+ Tender.READONLY_FIELDS
)
FIELDS_TO_REMOVE = (
["_state", "_django_version"]
+ ["id", "slug", "siae_transactioned", "extra_data", "import_raw_object"]
+ Tender.READONLY_FIELDS
)
def duplicate(tender: Tender, fields_to_remove=FIELDS_TO_REMOVE) -> Tender:

Je le mettrais en argument au cas où ^^

L'autre option serait de laisser comme t'as fait initialement et t'ajoute un argument à duplicate du type extra_fields_to_remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay t'as raison je vais rendre ca un peu plus réutilisable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixé ici 9661477

@raphodn raphodn merged commit 1c5a9ed into master Feb 22, 2024
5 checks passed
@raphodn raphodn deleted the raphodn/tender-duplicate-helper branch February 22, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants