I’m creating a simple To Do app using Django 3.2, and I have stuck in a error which is: FieldError: Cannot resolve keyword ‘user’ into field. Choices are: content, created, email, id, name, user1, user1_id This is models.py: forms.py views.py home.html By far, any data that is added can be access by every account, but what i’m trying to do
Tag: django
When i hit the “PUBLISH COMMENT BUTTON” the comments does not get posted in my frontend in django
i am making a comment section in django but when i hit the comment section the comment does get published to the comment section of my website it just refreshed the page and does nothing but when i add a comment from my backend which is the admin section it works perfectly fine and get updated in my front end
Unable to Deploy Django App to Heroku because of PyWin32
So I have gone through the forums in search for an answer but haven’t found one that works for me. I am using Windows machine and my Django application works on Localhost but when I try to deploy the same application to Heroku it gives me this error. I have removed pywin32 from the requirements.txt file but still when I
How to get the param PK in django restframework permission?
I have this permission in Django that look like this: Can anybody help me get the params of request I tried using self.kwargs[“pk”], request.POST[‘pk’] but they all return saying object has no attribute. Answer If pk is a parameter of the POST request, you can access it with request.POST.get(‘pk’). In your post, you are not using get(), so that could
How to update the one attribute of model once form is validated in Django?
I have a model and a form Now I have captured all the data using POST API form is validated. How do I update status parameter of model in django after form validation is successful ? Answer Retrieve the underlying model instance, change the field value and save the form.
TypeError: expected str, bytes or os.PathLike object, not JpegImageFile (or PngImageFile) in Django
When I am uploading a picture to check a picture according to tensorflow h5 model, I am loading the image using load_model of tensorflow.keras.models but it is not accepting. For JPG, it is showing TypeError: expected str, bytes or os.PathLike object, not JpegImageFile and for PNG, it is showing as TypeError: expected str, bytes or os.PathLike object, not PngImageFile. What
How to serialize first photo in album? Django
How to serialize first photo in album if photo connected by using FK with model Gallery. I need first photo for gallery cover in galley list. My models: Anyone have any ideas? May be I need suchlike request Gallery.objects.get(id=id).photos.first() but i not sure is it correct. Answer get returns only one object. filter returns multiple objects. You can access the
Getting CSRF token missing error on a django rest framework (with TokenAuthentication) public APIView
I’m having issue with Django Rest Framework and CSRF configurations. I know there are plenty of similar posts on the subject (like this one Django Rest Framework remove csrf) but most of them do not apply (I’m not using SessionAuthentication, nor Django templates), and the way DRF handles CSRF is still unclear to me. Here is the situation : I
Setting a dropdowns values based on a different model selection
I currently have a model with 2 fields: Name & Number of Units When the first field is selected e.g. Name = Name1 I would like to display the Number Of Units saved in association with that model. e.g. Name1 has 50 units then the second < select > will show the number a list from 1 – 50 because
Problem with Django does not detect change in python code every time need to restart the server (problem in runserver)
I have a problem my django server does not show the updated python code when refreshing the page everytime i need to restart the server i searched the internet and all what i found is when i run the server it automatically detect any change in the code but i use it and it does not detect the change any