Skip to content

Commit

Permalink
fix urls
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Oct 22, 2023
1 parent 5e19077 commit b9ae46d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
20 changes: 14 additions & 6 deletions codeforlife/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
def service_urlpatterns(
api_urls_path: str = "api.urls",
frontend_template_name: str = "frontend.html",
user_urls_path: str = "codeforlife.user.urls",
include_user_urls: bool = True,
):
# Specific url patterns.
urlpatterns = [
path(
"admin/",
Expand Down Expand Up @@ -43,11 +44,18 @@ def service_urlpatterns(
),
name="session-expired",
),
path(
"api/",
include(user_urls_path),
name="user",
),
]

# General url patterns.
if include_user_urls:
urlpatterns.append(
path(
"api/",
include("codeforlife.user.urls"),
name="user",
)
)
urlpatterns += [
path(
"api/",
include(api_urls_path),
Expand Down
10 changes: 2 additions & 8 deletions codeforlife/user/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@


class UserSerializer(serializers.ModelSerializer):
student = StudentSerializer(source="new_student", read_only=True)
teacher = TeacherSerializer(source="new_teacher", read_only=True)
current_password = serializers.CharField(write_only=True)
student = StudentSerializer(source="new_student")
teacher = TeacherSerializer(source="new_teacher")

class Meta:
model = User
fields = "__all__"
extra_kwargs = {
"id": {"read_only": True},
"username": {"read_only": True},
"isActive": {"read_only": True},
"isStaff": {"read_only": True},
"dateJoined": {"read_only": True},
"lastLogin": {"read_only": True},
"password": {"write_only": True},
}

0 comments on commit b9ae46d

Please sign in to comment.