Commit 79c99791 authored by axelkjonsberg's avatar axelkjonsberg
Browse files

Remove unneeded comments

Either where code functionality is self evident or where the comment's content is better left to other types of documentation
parent 63108493
Pipeline #128410 failed with stage
in 1 minute and 2 seconds
...@@ -4,7 +4,6 @@ from django.db import models ...@@ -4,7 +4,6 @@ from django.db import models
from workouts.models import Workout from workouts.models import Workout
# Create your models here.
class Comment(models.Model): class Comment(models.Model):
"""Django model for a comment left on a workout. """Django model for a comment left on a workout.
......
...@@ -8,7 +8,6 @@ from comments.serializers import CommentSerializer ...@@ -8,7 +8,6 @@ from comments.serializers import CommentSerializer
from workouts.permissions import IsOwner, IsReadOnly from workouts.permissions import IsOwner, IsReadOnly
# Create your views here.
class CommentList( class CommentList(
mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView
): ):
...@@ -56,7 +55,6 @@ class CommentList( ...@@ -56,7 +55,6 @@ class CommentList(
return qs return qs
# Details of comment
class CommentDetail( class CommentDetail(
mixins.RetrieveModelMixin, mixins.RetrieveModelMixin,
mixins.UpdateModelMixin, mixins.UpdateModelMixin,
......
...@@ -44,8 +44,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer): ...@@ -44,8 +44,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
password_validation.validate_password(password) password_validation.validate_password(password)
except forms.ValidationError as error: # pragma no cover except forms.ValidationError as error: # pragma no cover
raise serializers.ValidationError(error.messages) raise serializers.ValidationError(error.messages)
# Fix for unequal passwords getting accepted
if password != password1: if password != password1:
raise serializers.ValidationError(detail="Passwords did not match") raise serializers.ValidationError(detail="Passwords did not match")
......
...@@ -14,7 +14,6 @@ from workouts.parsers import MultipartJsonParser ...@@ -14,7 +14,6 @@ from workouts.parsers import MultipartJsonParser
from workouts.permissions import IsOwner, IsReadOnly from workouts.permissions import IsOwner, IsReadOnly
# Create your views here.
class UserList(mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView): class UserList(mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView):
serializer_class = UserSerializer serializer_class = UserSerializer
users = [] users = []
......
...@@ -26,7 +26,6 @@ class OverwriteStorage(FileSystemStorage): ...@@ -26,7 +26,6 @@ class OverwriteStorage(FileSystemStorage):
os.remove(os.path.join(settings.MEDIA_ROOT, name)) os.remove(os.path.join(settings.MEDIA_ROOT, name))
# Create your models here.
class Workout(models.Model): class Workout(models.Model):
"""Django model for a workout that users can log. """Django model for a workout that users can log.
...@@ -48,15 +47,14 @@ class Workout(models.Model): ...@@ -48,15 +47,14 @@ class Workout(models.Model):
get_user_model(), on_delete=models.CASCADE, related_name="workouts" get_user_model(), on_delete=models.CASCADE, related_name="workouts"
) )
# Visibility levels PUBLIC = "PU"
PUBLIC = "PU" # Visible to all authenticated users COACH = "CO"
COACH = "CO" # Visible only to owner and their coach PRIVATE = "PR"
PRIVATE = "PR" # Visible only to owner
VISIBILITY_CHOICES = [ VISIBILITY_CHOICES = [
(PUBLIC, "Public"), (PUBLIC, "Public"),
(COACH, "Coach"), (COACH, "Coach"),
(PRIVATE, "Private"), (PRIVATE, "Private"),
] # Choices for visibility level ]
visibility = models.CharField( visibility = models.CharField(
max_length=2, choices=VISIBILITY_CHOICES, default=COACH max_length=2, choices=VISIBILITY_CHOICES, default=COACH
...@@ -108,8 +106,8 @@ class ExerciseInstance(models.Model): ...@@ -108,8 +106,8 @@ class ExerciseInstance(models.Model):
exercise = models.ForeignKey( exercise = models.ForeignKey(
Exercise, on_delete=models.CASCADE, related_name="instances" Exercise, on_delete=models.CASCADE, related_name="instances"
) )
sets = models.PositiveIntegerField() # Fix for negative sets allowed sets = models.PositiveIntegerField()
number = models.PositiveIntegerField() # Fix for negative number allowed number = models.PositiveIntegerField()
def workout_directory_path(instance, filename): def workout_directory_path(instance, filename):
......
...@@ -5,7 +5,6 @@ from rest_framework_simplejwt.views import (TokenObtainPairView, ...@@ -5,7 +5,6 @@ from rest_framework_simplejwt.views import (TokenObtainPairView,
from workouts import views from workouts import views
# This is a bit messy and will need to change
urlpatterns = format_suffix_patterns( urlpatterns = format_suffix_patterns(
[ [
path("", views.api_root), 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