We're learning about Jango Girls in Korean Application extension part / post Add view to detail page If you type Post.objects.get(pk=pk) in the shell, It says doesnotexist at/post/10 When I type the low-key code on the shell, ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in NameError: name 'Post' is not defined
It doesn't work at all when I open it
If the error does not appear at/post/10, then page not found 404 This solves how to add a view to the views.py file....
I can't understand what you're asking even if I read the questions I wrote again
django python
Based on the error content, it seems that the model Post has not been imported.
If you are working on the shell, please run the code to import the Post in advance.
Typically, it should be in the same format as from appname.models importPost
.
You'll get an error if you run it from the shell. Because pk is not defined. Looking at the contents of Jango Girls' page, Post.objects.get(pk=pk)
should be defined in the method def post_detail(request,pk):
.
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.