From d5827b2006663231c0a01a9a205db62f8a269ee7 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 24 Dec 2020 18:14:40 +0100 Subject: [PATCH] Fixed filename generation. --- django_lostplaces/lostplaces/models/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_lostplaces/lostplaces/models/models.py b/django_lostplaces/lostplaces/models/models.py index d577405..5b9b986 100644 --- a/django_lostplaces/lostplaces/models/models.py +++ b/django_lostplaces/lostplaces/models/models.py @@ -27,7 +27,7 @@ def generate_profile_image_filename(instance, filename): Returns filename as: explorer_pk-username.jpg """ - return 'explorers/' + str(instance.explorer.pk) + '-' + str(instance.explorer.username) + '.' + filename.split('.')[-1] + return 'explorers/' + str(instance.user.pk) + '-' + str(instance.user.username) + '.' + filename.split('.')[-1] class Explorer(models.Model): """