Commit cbd2037e authored by Sondre Westby Liestøl's avatar Sondre Westby Liestøl
Browse files

Refactoring up for testing

parent 047eb2dd
Pipeline #170404 passed with stage
in 1 minute and 13 seconds
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
asgiref = "==3.2.10"
astroid = "==2.4.2"
certifi = "==2020.6.20"
chardet = "==3.0.4"
colorama = "==0.4.3"
dj-database-url = "==0.5.0"
django-cleanup = "==5.0.0"
django-cors-headers = "==3.4.0"
djangorestframework = "==3.11.1"
djangorestframework-simplejwt = "==4.4.0"
gunicorn = "==20.0.4"
httpie = "==2.2.0"
idna = "==2.10"
isort = "==4.3.21"
lazy-object-proxy = "==1.4.3"
mccabe = "==0.6.1"
psycopg2-binary = "==2.9.3"
pylint = "==2.5.3"
pylint-django = "==2.3.0"
pylint-plugin-utils = "==0.6"
pytest-django = "==4.3.0"
pytz = "==2020.1"
requests = "==2.24.0"
rope = "==0.17.0"
six = "==1.15.0"
sqlparse = "==0.3.1"
toml = "==0.10.1"
urllib3 = "==1.25.10"
whitenoise = "==5.2.0"
wrapt = "==1.12.1"
Django = "==3.1"
Pygments = "==2.6.1"
PyJWT = "==1.7.1"
[requires]
python_version = "3.8"
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.1"
......@@ -45,7 +45,7 @@ class CommentList(
# The code below is kind of duplicate of the one in ./permissions.py
# We should replace it with a better solution.
# Or maybe not.
"""
qs = Comment.objects.filter(
Q(workout__visibility="PU")
| Q(owner=self.request.user)
......@@ -55,11 +55,11 @@ class CommentList(
)
| Q(workout__owner=self.request.user)
).distinct()
"""
for obj in Comment.objects:
"""for obj in Comment.objects:
if IsCommentVisibleToUser.has_object_permission(self, self.request, None, obj):
qs.append(obj)
qs.append(obj)"""
return qs.distinct()
......
......@@ -10,23 +10,6 @@ from django.core.files.storage import FileSystemStorage
from django.conf import settings
from django.contrib.auth import get_user_model
#This should be removed as it is unused
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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment