Skip to content
Advertisement

Tag: django

Not able to do Insert operation in CRUD

I am making a CRUD of colors with color_name and color_description. While trying to insert the details the error below has be shown: below is the insert and show function that I have tried out model HTML of insert_color HTML of show color I have checked the names assigned and they are matching, so where am I going wrong? Answer

Django csv upload to db works but throws error

I have created an app named customer within a project named Website using django. I have created a csv upload in the admin area which is connected to the Postgres db. However the CSV file is still added to the db but the error screen is displayed. Even more strangely if I a notepad doc as csv containing the data

How to use data from postgresql in django?

I have switched from sqlite to postgresql following Django: What are the best practices to migrate a project from sqlite to PostgreSQL the fourth answer. Here are my updated settings: However, I cannot seem to find/grab any of the data from my database. Here’s some example data from the database: The migration works successfully with my postgres as I have

No Django POST data when sent over a form?

I am on a development server (no CSRF protection), sending over login data to Django via a web form (Django: 127.0.0.1:8000). HTML: Django: I’m pretty sure that the POST data is not being transmitted (TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘str’) in the print statement, but I can’t figure out why. (The HTML is on localhost and the

How can I optimze Django Code to only one query request

I have a simple django project which displays previous reservations dates based on id’s. However currently there are 2 requests being made. (N+1 sql requests, where N is the reservation’s count) Do you have any idea how i would be able to optimize this code to only 1 query? This is the model.py file This is the view.py file ->

Advertisement