Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix 500 error on /contest/<code>/leave #1956

Merged
merged 2 commits into from
Jul 18, 2022
Merged

Fix 500 error on /contest/<code>/leave #1956

merged 2 commits into from
Jul 18, 2022

Conversation

int-y1
Copy link
Contributor

@int-y1 int-y1 commented Jun 12, 2022

The 500 error: visit https://dmoj.ca/contest/cheerio1j/leave while logged in.

The issue is that a GET request goes to BaseDetailView.get then crashes at self.render_to_response. https://github.com/django/django/blob/5c3300027b30c1b498d99010f7d618316f685045/django/views/generic/detail.py#L103-L108

In the new version, GET requests receive error 405.

Also, ContestJoin doesn't need BaseDetailView because ContestJoin implements its own get method.

@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2022

Codecov Report

Merging #1956 (4a222fe) into master (966b37d) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1956   +/-   ##
=======================================
  Coverage   46.46%   46.46%           
=======================================
  Files         236      236           
  Lines       13114    13114           
=======================================
  Hits         6093     6093           
  Misses       7021     7021           
Impacted Files Coverage Δ
judge/views/contests.py 29.23% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 966b37d...4a222fe. Read the comment docs.

@int-y1 int-y1 changed the title Fix a 500 error on an endpoint Fix 500 error on /contest/<code>/leave Jun 12, 2022
Copy link
Member

@Ninjaclasher Ninjaclasher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kiritofeng kiritofeng requested review from quantum5, Xyene and WallE256 July 3, 2022 01:54
Copy link
Member

@Xyene Xyene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Xyene Xyene merged commit 230a7d7 into DMOJ:master Jul 18, 2022
@int-y1 int-y1 deleted the get-500 branch July 25, 2022 06:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants