Commit 89fada6a authored by Erlend Ydse's avatar Erlend Ydse
Browse files

Merge branch 'refactor-manual-review' of...

Merge branch 'refactor-manual-review' of gitlab.stud.idi.ntnu.no:tdt4242-spring-2021-t17/tdt4242-base into refactor-manual-review
parents 55eda8db 79c99791
Pipeline #128412 failed with stage
in 1 minute and 5 seconds
......@@ -4,7 +4,6 @@ from django.db import models
from workouts.models import Workout
# Create your models here.
class Comment(models.Model):
"""Django model for a comment left on a workout.
......
......@@ -8,7 +8,6 @@ from comments.serializers import CommentSerializer
from workouts.permissions import IsOwner, IsReadOnly
# Create your views here.
class CommentList(
mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView
):
......@@ -56,7 +55,6 @@ class CommentList(
return qs
# Details of comment
class CommentDetail(
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
......
......@@ -44,8 +44,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
password_validation.validate_password(password)
except forms.ValidationError as error: # pragma no cover
raise serializers.ValidationError(error.messages)
# Fix for unequal passwords getting accepted
if password != password1:
raise serializers.ValidationError(detail="Passwords did not match")
......
......@@ -22,7 +22,6 @@ from workouts.parsers import MultipartJsonParser
from workouts.permissions import IsOwner, IsReadOnly
# Create your views here.
class UserList(mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView):
serializer_class = UserSerializer
users = []
......
......@@ -26,7 +26,6 @@ class OverwriteStorage(FileSystemStorage):
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.
......@@ -48,15 +47,14 @@ class Workout(models.Model):
get_user_model(), on_delete=models.CASCADE, related_name="workouts"
)
# Visibility levels
PUBLIC = "PU" # Visible to all authenticated users
COACH = "CO" # Visible only to owner and their coach
PRIVATE = "PR" # Visible only to owner
PUBLIC = "PU"
COACH = "CO"
PRIVATE = "PR"
VISIBILITY_CHOICES = [
(PUBLIC, "Public"),
(COACH, "Coach"),
(PRIVATE, "Private"),
] # Choices for visibility level
]
visibility = models.CharField(
max_length=2, choices=VISIBILITY_CHOICES, default=COACH
......@@ -108,8 +106,8 @@ class ExerciseInstance(models.Model):
exercise = models.ForeignKey(
Exercise, on_delete=models.CASCADE, related_name="instances"
)
sets = models.PositiveIntegerField() # Fix for negative sets allowed
number = models.PositiveIntegerField() # Fix for negative number allowed
sets = models.PositiveIntegerField()
number = models.PositiveIntegerField()
def workout_directory_path(instance, filename):
......
......@@ -5,7 +5,6 @@ from rest_framework_simplejwt.views import (TokenObtainPairView,
from workouts import views
# This is a bit messy and will need to change
urlpatterns = format_suffix_patterns(
[
path("", views.api_root),
......
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