Django error 'no such table' adding 'Comedy' genre (Video 12.9 Complete Python Mastery course)

Getting this error “Exception Value: no such table: main.auth_user__old” when attempting to add the ‘Comedy’ genre via the web admin interface.
I’m following Mosh’s video 12.9 of Complete Python Mastery. I have followed all his instructions.
Here’s the exact error
" OperationalError at /admin/movies/genre/add/

no such table: main.auth_user__old

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/movies/genre/add/
Django Version: 2.1
Exception Type: OperationalError
Exception Value: no such table: main.auth_user__old
Exception Location: C:\Users\me\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296
Python Executable: C:\Users\me\AppData\Local\Programs\Python\Python38-32\python.exe
Python Version: 3.8.5
SQLite library version: 3.32.2

I have attempted all the steps twice. I can add the genre values manually through DB browser, but not through the Django interface.
I have found this help article https://stackoverflow.com/questions/53637182/django-no-such-table-main-auth-user-old
and followed the instructions to:

  1. delete db.sqlite3
  2. python manage.py makemigrations
  3. python manage.py migrate
    Still get the same result.
    The stackoverflow eludes to a Django old-version incompatibility with newer SQLite. Perhaps that is a problem and Mosh should redo the videos with a newer Django version. Current version of Django is 3.1.1 as of today. In his video 12.9, Mosh’s version of Django requires 2.1. I will test out theory of newer Django version. If anyone has another idea, I’m open to the idea.
1 Like

Solution: upgrade to latest Django version (at least 3.1.2)
Steps to fix:
I stopped the django webserver running, Ctrl-C
I kept my vidly app project as is according to Chapter 12.1-12.9.
I deleted the db.sqlite3
I uninstalled Django 2.1
I installed latest version of Django with “pip install django” which installed version 3.1.2
Issued “python manage.py makemigrations”
Issued “python manage.py migrate”
Created a superuser with “python manage.py createsuperuser”
Issued “python manage.py runserver”
Navigated to http://127.0.0.1:8000/admin/
I was successfully able to add two genres manually.

The Django version 2.1 is probably incompatible with the current version of SQLite.
Mosh, please update the instructions to Complete Python Mastery Chapter 12 accordingly. I teach a university class and have all my students purchase your course. Great course, needs some updates please.

6 Likes

Thanks shumpherys,

Your solution to ‘no table’ error while adding a product worked for me too. It seemed you were right, the older version of Django was not supported by newer version of SQLite.

It is working. Thank you sir.

Thanks shumpherys!! works like a charm!!

Thank you very much! Appreciated!!!

I have found this helpful article in stack overflow