getting error when trying to add object in django admin - django

error page
Trace:
OperationalError at /admin/jobs/job/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/jobs/job/add/
Django Version: 2.0.2
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: C:\Users\codering\Desktop\myenv\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 303
Python Executable: C:\Users\codering\Desktop\myenv\Scripts\python.exe
Python Version: 3.8.0
Python Path:
['C:\\Users\\codering\\Desktop\\portfolio',
'C:\\Users\\codering\\Desktop\\myenv\\Scripts\\python38.zip',
'C:\\Users\\codering\\Desktop\\myenv\\DLLs',
'C:\\Users\\codering\\Desktop\\myenv\\lib',
'C:\\Users\\codering\\Desktop\\myenv\\Scripts',
'c:\\users\\codering\\appdata\\local\\programs\\python\\python38\\Lib',
'c:\\users\\codering\\appdata\\local\\programs\\python\\python38\\DLLs',
'C:\\Users\\codering\\Desktop\\myenv',
'C:\\Users\\codering\\Desktop\\myenv\\lib\\site-packages']
Server time: Wed, 20 Nov 2019 10:45:27 +0000
This page is opening when i am trying to add an object, can anyone help?

Try running
python manage.py makemigrations
python manage.py migrate
From command line

Related

Django: problem trying to post data to django model database

ProgrammingError at /admin/formRegister/formregister/
column formRegister_formregister.password1 does not exist
LINE 1: ...astname", "formRegister_formregister"."username", "formRegis...
^
Request Method: GET
Request URL: http://localhost:8000/admin/formRegister/formregister/
Django Version: 4.0.5
Exception Type: ProgrammingError
Exception Value:
column formRegister_formregister.password1 does not exist
LINE 1: ...astname", "formRegister_formregister"."username", "formRegis...
^
Exception Location: C:\Users\hp\Desktop\Django\django3.9\lib\site-packages\django\db\backends\utils.py, line 89, in _execute
Python Executable: C:\Users\hp\Desktop\Django\django3.9\Scripts\python.exe
Python Version: 3.9.13
Python Path:
['C:\Users\hp\Desktop\Django\teluskoa',
'C:\Program '
'Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\python39.zip',
'C:\Program '
'Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\DLLs',
'C:\Program '
'Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib',
'C:\Users\hp\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0',
'C:\Users\hp\Desktop\Django\django3.9',
'C:\Users\hp\Desktop\Django\django3.9\lib\site-packages']
Server time: Thu, 11 Aug 2022 16:02:26 +0000
It looks like migrations issue:
$ python manage.py makemigrations
$ python manage.py migrate

Deployed django app error: Relation does not exist

I deployed a django app using a postresql database with Heroku.
The app works perfectly on my local machine but when I want to create a user or to login using the deployed app, I run into the following error:
ProgrammingError at /register/
relation "register_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "register_user" WHERE "register_user"...
^
Request Method: POST
Request URL: https://the-gecko.herokuapp.com/register/
Django Version: 4.0.3
Exception Type: ProgrammingError
Exception Value:
relation "register_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "register_user" WHERE "register_user"...
^
Exception Location: /app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 89, in _execute
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.9.10
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python39.zip',
'/app/.heroku/python/lib/python3.9',
'/app/.heroku/python/lib/python3.9/lib-dynload',
'/app/.heroku/python/lib/python3.9/site-packages']
Server time: Mon, 21 Mar 2022 19:59:58 +0000
I believe this error has something do to with my postgres database, but I don't know what relevant code to share in that case.
Please, let me know if you have any idea how to solve that issue.

Failed to add a object in a app in the admin panel of Django

I am just a beginner in Django Web Development.Following a tutorial I tried to add a object on a app by admin in Django. This is a screenshot before adding object. After clicking Save button I got the error.
OperationalError at /admin/products/product/add/
no such table: main.auth_user__old
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/products/product/add/
Django Version: 2.1
Exception Type: OperationalError
Exception Value:
no such table: main.auth_user__old
Exception Location: C:\Users\royal\AppData\Local\Programs\Python\Python38-32\lib\site-
packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable: C:\Users\royal\AppData\Local\Programs\Python\Python38-32\python.exe
Python Version: 3.8.2
Python Path:
['C:\\Users\\royal\\PycharmProjects\\PyShop',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\win32',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\win32\\lib',
'C:\\Users\\royal\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\Pythonwin']
Server time: Tue, 24 Mar 2020 15:59:31 +0000
I'm completely new in this sector.Help me to get rid off this error.

Django error, constantly faced with the same server error even if I start an entirely new application and run it

OperationalError at /
no such table: core_document
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 2.1.4
Exception Type: OperationalError
Exception Value:
no such table: core_document
Exception Location: C:\Python37-32\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable: C:\Python37-32\python.exe
Python Version: 3.7.1
Python Path:
['E:\Django\Dec19\simple-file-upload-master',
'C:\Python37-32\python37.zip',
'C:\Python37-32\DLLs',
'C:\Python37-32\lib',
'C:\Python37-32',
'C:\Python37-32\lib\site-packages']
Server time: Wed, 19 Dec 2018 04:22:57 +0000
Try to run migrations:
python manage.py makemigrations
python manage.py migrate
The first line of the error explains the core issue:
OperationalError at / no such table: core_document
The table which is being referenced doesn't exist. This usually happens when migrations haven't successfully run. To begin troubleshooting (and to possibly fix the problem entirely), run the Django migrations:
python manage.py makemigrations
python manage.py migrate

Error in testing part of my django poll app

I get the following error in my django poll app. I do not understand what it states, can anyone suggest me what to do? Any solution to this?
NameError at / name 'model' is not defined
Request Method: GET Request URL: http://127.0.0.1:8000/
Django Version: 1.8.6
Exception Type: NameError
Exception Value: name 'model' is not defined
Exception Location: c:\Anaconda-installation\mysite\polls\views.py in ResultView, line 26
Python Executable: C:\Anaconda-installation\python.exe
Python Version: 2.7.10
Python Path: ['c:\\Anaconda-installation\\mysite',
'C:\\Anaconda-installation\\python27.zip',
'C:\\Anaconda-installation\\DLLs',
'C:\\Anaconda-installation\\lib',
'C:\\Anaconda-installation\\lib\\plat-win',
'C:\\Anaconda-installation\\lib\\lib-tk',
'C:\\Anaconda-installation',
'c:\\anaconda-installation\\lib\\site-packages\\sphinx-1.3.1-py2.7.egg',
'c:\\anaconda-installation\\lib\\site-packages\\setuptools-17.1.1-py2.7.egg',
'C:\\Anaconda-installation\\lib\\site-packages',
'C:\\Anaconda-installation\\lib\\site-packages\\cryptography-0.9.1-py2.7-win-amd64.egg',
'C:\\Anaconda-installation\\lib\\site-packages\\win32',
'C:\\Anaconda-installation\\lib\\site-packages\\win32\\lib',
'C:\\Anaconda-installation\\lib\\site-packages\\Pythonwin']
Server time: Tue, 8 Dec 2015 04:49:21 +0000