display name uniqueness

This commit is contained in:
Matteo Rosati
2026-02-11 12:26:54 +01:00
parent 6cbaf5f6ee
commit 01fd047568
4 changed files with 24 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ class UserProfile(models.Model):
on_delete=models.CASCADE,
related_name="profile",
)
display_name = models.CharField(max_length=150)
display_name = models.CharField(max_length=150, unique=True)
def __str__(self):
return f"{self.display_name} ({self.user.username})" # type: ignore[attr-defined]