Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mureytasroc committed Oct 30, 2023
1 parent f482b14 commit 7b6cc63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion backend/PennCourses/docs_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
[
Expand Down
11 changes: 5 additions & 6 deletions backend/plan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."},
Expand Down

0 comments on commit 7b6cc63

Please sign in to comment.