From fd08e3c58aa221082939954859b5d524951d03bb Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sat, 15 Jul 2023 00:01:51 +0800 Subject: [PATCH] Change profile photo filename --- stude/accounts/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stude/accounts/models.py b/stude/accounts/models.py index 4f33659..e34a78c 100644 --- a/stude/accounts/models.py +++ b/stude/accounts/models.py @@ -20,11 +20,9 @@ def validate_student_id(value): class CustomUser(AbstractUser): def _get_upload_to(instance, filename): base_filename, file_extension = os.path.splitext(filename) - # Convert filename to a slug format - cleaned_filename = slugify(base_filename) # Get the student ID number student_id = str(instance.student_id_number) - new_filename = f"{student_id}_{cleaned_filename}{file_extension}" + new_filename = f"{student_id}_{file_extension}" return os.path.join('avatars', new_filename) first_name = models.CharField(max_length=100)