Skip to content

Commit

Permalink
Merge pull request #675 from jackmulligan-ire/uuid-rename
Browse files Browse the repository at this point in the history
UUID rename
  • Loading branch information
rolandgeider authored May 9, 2021
2 parents 520ef4b + c02862c commit 4220348
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Developers
* Brad Johnson - https://github.com/bradsk88
* Sidrah Madiha Siddiqui https://github.com/Sidrah-Madiha
* Calvin Walden - https://github.com/calvinrw
* Jack Mulligan - https://github.com/jackmulligan-ire

Translators
-----------
Expand Down
4 changes: 3 additions & 1 deletion wger/exercises/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Standard Library
import logging
import uuid
import pathlib

# Django
from django.conf import settings
Expand Down Expand Up @@ -439,7 +440,8 @@ def exercise_image_upload_dir(instance, filename):
"""
Returns the upload target for exercise images
"""
return "exercise-images/{0}/{1}".format(instance.exercise_base.id, filename)
ext = pathlib.Path(filename).suffix
return "exercise-images/{0}/{1}{2}".format(instance.exercise_base.id, instance.uuid, ext)


class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
Expand Down

0 comments on commit 4220348

Please sign in to comment.