Reference Section# 20
Add post assign logged in user to author
Sir, I am trying to add a post but the following bug appearing. I tried my best to debug it but failed. kindly help in this regard.
models.py
Ejaz Ali Inayat,what issue are you actually facing? Could you provide us with a screenshot of your issue? This will help us provide you with a proper solution.

@mohaiminul-islam Sir, I have attached the screenshot of the issue
The issue you are facing occurs because, when you try to create a blog, the feature image is not receiving any input. This can happen for several reasons:
-
In your
forms.py
, the feature image field may not be correctly added. -
It can also happen if you have not included
enctype="multipart/form-data"
in your form tag within the template.
Please check these issues. If you are still unable to fix them, kindly share your updated GitHub repository with us.

@mohaiminul-islam Sir, the following error is appearing.
form is invalid
- featured_image
- This field is required.
I think you did not try my previous answer. Earlier, in point number 2, I mentioned that you need to include enctype="multipart/form-data"
in your form tag. However, I did not see this in your code. I have added it, and your issue is now resolved. Here is the full code:
Please watch the videos carefully. If you face any issues, ask in the Q&A section and make sure to follow the steps we provided to resolve the issue.