Skip to content

Commit

Permalink
fix: linting errors on #131
Browse files Browse the repository at this point in the history
  • Loading branch information
DeLany123 committed Mar 27, 2024
1 parent c2a741a commit 744f994
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/api/permissions/student_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from api.permissions.role_permissions import is_teacher
from authentication.models import User


class StudentPermission(IsAuthenticated):

def has_permission(self, request, view):
"""Check if user has permission to view a general student endpoint."""
user: User = request.user
if view.action in ['list', 'create', 'update', 'partial_update', 'destroy']:
return False
return True
Expand Down
2 changes: 1 addition & 1 deletion backend/api/permissions/teacher_permissions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from rest_framework.permissions import IsAuthenticated, SAFE_METHODS
from authentication.models import User


# (Almost) same as StudentPermission
class TeacherPermission(IsAuthenticated):

def has_permission(self, request, view):
"""Check if user has permission to view a general Teacher endpoint."""
user: User = request.user
if view.action in ['list', 'create', 'update', 'partial_update', 'destroy']:
return False
return True
Expand Down
2 changes: 1 addition & 1 deletion backend/api/views/student_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StudentViewSet(viewsets.ModelViewSet):
@action(detail=True)
def courses(self, request, **_):
"""Returns a list of courses for the given student"""
student = self.get_object()
student = self.get_object()
courses = student.courses.all()

# Serialize the course objects
Expand Down
1 change: 1 addition & 0 deletions backend/api/views/teacher_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from api.permissions.teacher_permissions import TeacherPermission
from rest_framework.permissions import IsAuthenticated


class TeacherViewSet(ModelViewSet):
queryset = Teacher.objects.all()
serializer_class = TeacherSerializer
Expand Down
1 change: 1 addition & 0 deletions backend/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def get_dummy_admin():
is_staff=True
)


class Faculty(models.Model):
"""This model represents a faculty."""

Expand Down

0 comments on commit 744f994

Please sign in to comment.