[knowledge-base] Add Contributor Upload Form Backend#780
Conversation
mrollinswaterman
left a comment
There was a problem hiding this comment.
All functionality looks good to me! Couple notes on mostly cosmetic/QoL stuff:
-
Might be nice to have something to indicate a file has been uploaded properly. Right now, there's no change on the screen so it's kind of hard to tell.
-
Hand in hand with that, I think /upload and /reupload should redirect to some other page once the a file has successfully been uploaded. Probably just back to the contributor page, but it's up to you.
Other than that, everything looks great! Good stuff.
…wledge-base/contributor/upload-mdfile-backend
|
Thank you Miles for this quick and helpful feedback! |
jacqsmei
left a comment
There was a problem hiding this comment.
nice work! you can make a follow up pr for showing the upload state (maybe some kind of green check if successful, some error handling if not?)
…tps://github.com/uchicago-cs/chigame into knowledge-base/contributor/upload-mdfile-backend
|
Issue Score: Excellent Comments: |
This PR implements the backend of knowledge base contributor's upload page, where they upload the md file of the guide.
I not only include the initial upload page, but also a reupload page, for users whose guide is under "change requested" status and wishes to reupload their guide to address the changes.
Description
The implemented feature of both upload and reupload pages includes the following:
- for upload page, all logged-in users can access this page, and unlogged-in users are redirected to the log in page
- for reupload page, only logged-in user who authors this guide and is under "change requested" status can access, otherwise will display 403.
File Changes
Specifically, the files I change are:
views.py: add theContributorMdUploadview that handles both upload and reupload according to the logic aboveforms.py: add the form that takes in a game and a md file; the game field is read-only for reupload, and non-md file type will throw an errorurls.py: add the link for upload and reuploadcontributor_upload.html: modify according toviews.pyto give an unstylished view of the upload pageTesting
To test it, first pull this branch, load the fixture according to
knowledge-base/fixtures/README.md, and then runserver.