Improve user search, DB nulls, and chat UI
Change username filter to use icontains for partial/case-insensitive matching. In CustomUser.save, introduce _NULLABLE_CHAR_FIELDS and convert empty string char fields to None to ensure nullable fields are stored consistently. Update CreateChatModal to always show a subtitle combining the user's full name and account creation date (joined with " · "), improving UI information.
This commit is contained in:
@@ -116,7 +116,13 @@ class CustomUser(SoftDeleteModel, AbstractUser):
|
||||
|
||||
return super().delete(*args, **kwargs)
|
||||
|
||||
_NULLABLE_CHAR_FIELDS = ('phone_number', 'city', 'street', 'country', 'postal_code', 'email_verification_token')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
for field in self._NULLABLE_CHAR_FIELDS:
|
||||
if not getattr(self, field):
|
||||
setattr(self, field, None)
|
||||
|
||||
is_new = self._state.adding # True if object hasn't been saved yet
|
||||
|
||||
# Pre-save flags for new users
|
||||
|
||||
Reference in New Issue
Block a user