Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marius Engen
tdt4242-secfit
Commits
193ec55a
Commit
193ec55a
authored
Apr 06, 2022
by
Marius Engen
Browse files
Remove unused FileStorage class
parent
028260d4
Pipeline
#172977
passed with stage
in 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/secfit/workouts/models.py
View file @
193ec55a
...
...
@@ -2,30 +2,11 @@
log workouts (Workout), which contain instances (ExerciseInstance) of various
type of exercises (Exercise). The user can also upload files (WorkoutFile) .
"""
import
os
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.core.files.storage
import
FileSystemStorage
from
django.db
import
models
class
OverwriteStorage
(
FileSystemStorage
):
"""Filesystem storage for overwriting files. Currently unused."""
def
get_available_name
(
self
,
name
,
max_length
=
None
):
"""https://djangosnippets.org/snippets/976/
Returns a filename that's free on the target storage system, and
available for new content to be written to.
Args:
name (str): Name of the file
max_length (int, optional): Maximum length of a file name. Defaults to None.
"""
if
self
.
exists
(
name
):
os
.
remove
(
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
name
))
# Create your models here.
class
Workout
(
models
.
Model
):
"""Django model for a workout that users can log.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment