(contacts) add notes & force full_name

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.
This commit is contained in:
Quentin BEY
2024-11-28 10:55:44 +01:00
committed by BEY Quentin
parent 6d5d0f7ebb
commit 625f122ad5
6 changed files with 93 additions and 13 deletions

View File

@@ -113,11 +113,11 @@ class Contact(BaseModel):
null=True,
blank=True,
)
full_name = models.CharField(_("full name"), max_length=150, null=True, blank=True)
full_name = models.CharField(_("full name"), max_length=150)
short_name = models.CharField(_("short name"), max_length=30, null=True, blank=True)
# avatar =
# notes =
notes = models.TextField(_("notes"), blank=True, default="")
data = models.JSONField(
_("contact information"),
help_text=_("A JSON object containing the contact information"),
@@ -151,7 +151,7 @@ class Contact(BaseModel):
]
def __str__(self):
return self.full_name or self.short_name
return self.full_name
def clean(self):
"""Validate fields."""