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

✨(contacts) add notes & force full_name #565

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

qbey
Copy link
Collaborator

@qbey qbey commented Nov 28, 2024

Purpose

We make the full name mandatory and add a field to allow user to store personal notes on the contact.

This also make the "base" contact not mandatory because user may want to create new contacts out of the blue.

Note: this PR also renames the base field to override to be more explicit.

FIXES #506

Proposal

  • Add notes field
  • Make full_name mandatory
  • Rename base field to override

@qbey qbey self-assigned this Nov 28, 2024
@qbey qbey force-pushed the qbey/contacts_add_fields branch 2 times, most recently from 69ac7a3 to 32941fd Compare December 2, 2024 10:22
@qbey qbey marked this pull request as ready for review December 2, 2024 10:22
@qbey qbey added the backend label Dec 2, 2024
Copy link
Collaborator

@sdemagny sdemagny left a comment

Choose a reason for hiding this comment

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

Cool le renommage :)

@@ -115,7 +115,17 @@ class ContactFactory(BaseContactFactory):
class Meta:
model = models.Contact

base = factory.SubFactory("core.factories.ContactFactory", base=None, owner=None)
# base = factory.SubFactory("core.factories.ContactFactory", base=None, owner=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

tu as oublié de la supprimer ;)

@@ -20,49 +20,49 @@ def test_models_contacts_str_full_name():
def test_models_contacts_base_self():
"""A contact should not point to itself as a base contact."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dans ces deux lignes tu ne veux pas renommer le base en override ?

"{'__all__': ['A contact cannot point to a base contact that itself points to a "
"base contact.', 'A contact cannot be based on itself.']}"
"{'__all__': ['A contact cannot point to a base contact that itself overrides "
"a contact.', 'A contact cannot override itself.']}"
)
assert str(excinfo.value) == error_message


def test_models_contacts_base_to_base():
"""A contact should not point to a base contact that is itself derived from a base contact."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pareil ici

"{'__all__': ['A contact cannot point to a base contact that itself points to a "
"base contact.']}"
"{'__all__': ['A contact cannot point to a base contact that itself overrides "
"a contact.']}"
)
assert str(excinfo.value) == error_message


def test_models_contacts_owner_base_unique():
"""There should be only one contact deriving from a given base contact for a given owner."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pareil ;)

We make the full name mandatory and add a field to
allow user to store personnal notes on the contact.

This also make the "base" contact not mandatory because
user may want to create new contacts out of the blue.
To improve code readability, I propose to rename
the contact field `override`. This comes along
with the fact a contact should not not always
override another (it's the case were I only want
to create some personal contacts).
@qbey qbey merged commit 60ab61d into main Dec 3, 2024
20 checks passed
@qbey qbey deleted the qbey/contacts_add_fields branch December 3, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[contact] Rajouter des champs dans le modèle contact
2 participants