✨(models) impose uniqueness on display name, to match ox's constraint
OpenXchange's primary key is display name (= first name + last name). It must be unique in the domain's context. We don't have context info but we can impose uniqueness by domain.
This commit is contained in:
committed by
Marie
parent
608f8c6988
commit
b24cb23a83
@@ -303,7 +303,15 @@ class Mailbox(AbstractBaseUser, BaseModel):
|
||||
db_table = "people_mail_box"
|
||||
verbose_name = _("Mailbox")
|
||||
verbose_name_plural = _("Mailboxes")
|
||||
unique_together = ("local_part", "domain")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["local_part", "domain"], name="unique_username"
|
||||
),
|
||||
models.UniqueConstraint(
|
||||
fields=["first_name", "last_name", "domain"],
|
||||
name="unique_ox_display_name",
|
||||
),
|
||||
]
|
||||
ordering = ["-created_at"]
|
||||
|
||||
def __str__(self):
|
||||
|
||||
Reference in New Issue
Block a user