diff --git a/backend/PennCourses/docs_settings.py b/backend/PennCourses/docs_settings.py index b0271a067..60e9e381c 100644 --- a/backend/PennCourses/docs_settings.py +++ b/backend/PennCourses/docs_settings.py @@ -278,7 +278,7 @@ def get_url_by_name(name): reverse = get_resolver().reverse_dict if name not in reverse: - raise ValueError(f"Tried to get URL by name '{reverse}', but no such URL exists.") + raise ValueError(f"Tried to get URL by name '{name}', but no such URL exists.") path = reverse[name][0][0][0] path = path.replace(r"%(pk)s", r"{id}") return "/" + re.sub(r"%\(([^)]+)\)s", r"{\1}", path) @@ -417,6 +417,7 @@ def get_url_by_name(name): ("courses-search", "GET"): "Course Search", ("section-search", "GET"): "Section Search", ("review-autocomplete", "GET"): "Retrieve Autocomplete Dump", + ("calendar-view", "GET"): "Get Calendar", } assert all( [ diff --git a/backend/plan/views.py b/backend/plan/views.py index fc6e88a5d..3f6506ae4 100644 --- a/backend/plan/views.py +++ b/backend/plan/views.py @@ -426,14 +426,13 @@ def update(self, request, pk=None): if not from_path and (not pk or not Schedule.objects.filter(id=pk).exists()): return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND) try: - schedule = ( - self.get_queryset().get_or_create( + if from_path: + schedule, _ = self.get_queryset().get_or_create( name=PATH_REGISTRATION_SCHEDULE_NAME, defaults={"person": self.request.user, "semester": get_current_semester}, - )[0] - if from_path - else self.get_queryset().get(id=pk) - ) + ) + else: + schedule = self.get_queryset().get(id=pk) except Schedule.DoesNotExist: return Response( {"detail": "You do not have access to the specified schedule."},