From post man, I’m trying to make POST request to an order API created using django restframework but I’m getting the following error: The specific point where the error is located is specified in the error but I find difficulty constructing VALID json for the request body. Here is how I’m making the request on postman: Here is the program:
Tag: django
How to create a url for two apps that have index function in django?
I am a newbie in Django. In one django project, I have two apps say college app and company app. In the college app. college/urls.py Company/urls.py How do I create a url of both these in the header.html ? I tried these but its not working. Answer There is a easier way to about this conflict just by using different
Django test with fixtures gives ForeignKeyViolation or IntegrityError
I am trying to write test cases for the Django RestAPI that we have but I have an issue with the fixtures loading. Everything works correctly when I have only one TestCase but when I add a second TestCase in a second django app I get django.db.utils.IntegrityError. My original intention was to create a general TestCase where I set up
Django upload multiple images per post
I want to let the user upload multiple images per post. Similarly to an e-commerce platform with multiple images per product. But till now the images are not sent to the database. That’s my code so far: models.py: forms.py: views.py: project_form.html: settings.py: project urls.py app urls.py Answer Issue: You have made ProjectForm which relates to Project model, but the image
How to resolve “NoReverseMatch” Error in Django?
So I’m trying to create a table of hosts, and as one of the fields of that table include a clickable link to an update page. Which will pass the host_id to the update page. I was hoping someone could tell me what I’m doing wrong with regards to passing the correct parameter to upate/<host_id>. As I’m not quite sure
Django celery error while adding tasks to RabbitMQ message queue : AttributeError: ‘ChannelPromise’ object has no attribute ‘__value__’
I have setup celery, rabbitmq and django web server on digitalocean. RabbitMQ runs on another server where my Django app is not running. When I am trying to add the tasks to the queue using delay I am getting an error AttributeError: ‘ChannelPromise’ object has no attribute ‘value’ From django shell I am adding the task to my message queue.
reset form to initial data in invalid_form and display error in Django
I have a profile form that shows email, user name and first name. user only allowed to change first name field and the others are read only, if user change HTML value in email and username then submit it, it returns error but fill the fields with invalid value entered. I tried create a new instance of form and render
(DRF) How to update a foreignkey field
I have two models, Account model & Thread model: If I have already created a thread that is ForeignKey to the Account model, I am not able to change the username of the Account model, returning the error FOREIGN KEY constraint failed. I guess the existing Thread model require a username to point to. Is there way to create a
Django technology implementation of line breaks by number of posts
My problem I am making a shopping mall using Django, Bootstrap I want to implement technology line break when the post becomes 4 I thought if I used col-3 and {$ for %} {% endfor %} it would be divided into four and line breaks. but not working How can i fix it? MY models My views My urls My
Can’t pass parameters in Django, giving MultiValueDictKeyError
I have gone through answers of this type of question but they don’t seem relevant for my problem. I have a class defined as follows: It also requires other inputs: params[“meta”][“xgb”] params[“combined”] And I pass them as follows: I try the same in Postman by putting all these parameters in “Body” (using “raw”) but get: Need help. Thanks. Answer