I am a newbie coder and I just started the cs50 web programming course on edEX. I seemingly cannot get my code to save a .md (markdown file) in a directory. For now I am just trying to save the .md file, I am not yet looking to redirect to the new entry's page. Please find a screenshot of my code below, corrections are welcome :)
-
Hello! Did you edit util.py in any way? Can you post your file please? Best regards– Fabio MancinSep 30, 2020 at 15:45
-
Hello, yes I did. Please find below the link to a dropbox folder containing the util.py file dropbox.com/s/w8hq13ibre4lnqa/util.py?dl=0– DaitoCodeSep 30, 2020 at 16:03
1 Answer
I don't think you need to edit your util.py the way you did (https://cs50.harvard.edu/web/2020/projects/1/wiki/ also says there is no need to do it), but anyway there is another problem in your code:
you are trying to validate the form with Django validation (form.is_valid()), but you don't actually have a form in your new_page function.
You should add it with something like
form = Your_New_Page_Form(request.POST)
and then you can validate it the way you did.
Hope I helped! Happy coding!
-
hello there, so using django forms for this project has taken an entirely different turn as I just noticed that my form is rendering in only my index.html file and no other html file. I have looked up documentation and posts by people with similar problems but nothing seems to work. Have you ever encountered such a problem with django forms? Oct 5, 2020 at 10:47