Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle join class requests #308

Merged
merged 27 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ name = "pypi"
# 3. Comment out the editable-codeforlife package under [dev-packages].
# 4. Set the ref key of the git-codeforlife packages under [packages] and
# [dev-packages] to have the same version number.
# 5. Run `pipenv install --dev` in your terminal.
# 5. Run `pipenv install --dev` in your terminal.

[packages]
codeforlife = {ref = "v0.14.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
codeforlife = {ref = "v0.14.6", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
# 🚫 Don't add [packages] below that are inhertited from the CFL package.
# TODO: check if we need the below packages
whitenoise = "==6.5.0"
Expand All @@ -48,7 +48,7 @@ google-cloud-container = "==2.3.0"
# "django-anymail[amazon_ses]" = "==7.0.*"

[dev-packages]
codeforlife = {ref = "v0.14.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
codeforlife = {ref = "v0.14.6", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
# codeforlife = {file = "../../codeforlife-package-python", editable = true, extras = ["dev"]}
# 🚫 Don't add [dev-packages] below that are inhertited from the CFL package.
# TODO: check if we need the below packages
Expand Down
114 changes: 57 additions & 57 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
© Ocado Group
Created on 06/02/2024 at 15:13:00(+00:00).
"""

# TODO: Move from common to here and update to match new models pattern
from common.models import SchoolTeacherInvitation
6 changes: 5 additions & 1 deletion backend/api/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
from .school_teacher_invitation import SchoolTeacherInvitationSerializer
from .student import StudentSerializer
from .teacher import TeacherSerializer
from .user import ReleaseStudentUserSerializer, UserSerializer
from .user import (
HandleIndependentUserJoinClassRequestSerializer,
ReleaseStudentUserSerializer,
UserSerializer,
)
6 changes: 2 additions & 4 deletions backend/api/serializers/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def validate_klass(self, value: str):
klass = Class.objects.get(access_code=value)
except Class.DoesNotExist as ex:
raise serializers.ValidationError(
"Class does not exist.",
code="does_not_exist",
"Class does not exist.", code="does_not_exist"
) from ex

if klass.teacher.school_id != teacher.school_id:
Expand All @@ -47,8 +46,7 @@ def validate(self, attrs):
instance = t.cast(t.Optional[User], self.parent.instance)
if instance and not instance.student:
raise serializers.ValidationError(
"Target user is not a student.",
code="not_student",
"Target user is not a student.", code="not_student"
)

return attrs
Loading
Loading