# Django Operational error no such table: main.auth\_user\_\_old

**URL:** <https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619>\
**Category:** Python\
**Created:** [August 22, 2022, 2:34pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619 "2022-08-22T14:34:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 22, 2022, 2:34pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/1 "2022-08-22T14:34:18Z")

</div>

stumbled with this error after following tutorial step by step , when I try adding a new Genre to movies app and save changes a message appears telling me that there is no such table  
this was the problem with the YouTube free Tutorial version also  
i looked this problem on stackoverflow but those solutions don’t work

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 22, 2022, 4:13pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/2 "2022-08-22T16:13:42Z")

</div>

Please share the relevant code snippet in a [code block](https://www.markdownguide.org/basic-syntax/#code-blocks). Also include a full stack trace if you have one (error probably says it was thrown at some particular line of your code).

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 23, 2022, 11:16am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/3 "2022-08-23T11:16:07Z")

</div>

# 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/](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\olado.virtualenvs\vidly-BM-idFl-\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 296 |
| Python Executable: | C:\Users\olado.virtualenvs\vidly-BM-idFl-\Scripts\python.exe |
| Python Version: | 3.10.5 |
| Python Path: | [‘C:\brandnewprojectcalledselenium\vidly’, ‘C:\Users\olado\AppData\Local\Programs\Python\Python310\python310.zip’, ‘C:\Users\olado\AppData\Local\Programs\Python\Python310\DLLs’, ‘C:\Users\olado\AppData\Local\Programs\Python\Python310\lib’, ‘C:\Users\olado\AppData\Local\Programs\Python\Python310’, ‘C:\Users\olado\.virtualenvs\vidly-BM-idFl-’, ‘C:\Users\olado\.virtualenvs\vidly-BM-idFl-\lib\site-packages’] |
| Server time: | Tue, 23 Aug 2022 11:15:11 +0000 |

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 23, 2022, 3:22pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/4 "2022-08-23T15:22:24Z")

</div>

Is that table name supposed to have an extra underscore (`_`) character? That looks like a typo: `auth_user__old` (maybe that should be `auth_user_old`?)

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 24, 2022, 5:21am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/5 "2022-08-24T05:21:28Z")

</div>

i didn’t create any table with either names , i just followed the tutorial step by step  
the step at which i got this error corresponds to the 12th section in complete python mastery for beginners and to be exact it is the 9th lecture (customizing the Admin ) at 3:03 when he clicks SAVE , in my case this error appears

 ![Screenshot (215)](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/7/7f81d2c6b670d0bf192d5a6b30a5111ce683ff30.png)

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 24, 2022, 3:29pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/6 "2022-08-24T15:29:14Z")

</div>

What code are you running?

Which course lesson is this tied to? Ideally a link to the lesson would be appreciated.

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 25, 2022, 5:30am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/7 "2022-08-25T05:30:23Z")

</div>

> **[9- Customizing the Admin](https://codewithmosh.com/courses/417695/lectures/9219267)**
>
> Everything you need to program in Python in one course (includes 3 real-world projects)

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 25, 2022, 7:00pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/8 "2022-08-25T19:00:20Z")

</div>

has this been reported to mosh personally ?

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 25, 2022, 7:43pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/9 "2022-08-25T19:43:01Z")

</div>

Mosh does not generally monitor the forums himself (though he does have a user: programmingwithmosh). His support team is fairly responsive if you @ mention them (codewithmosh). Most of us who are responding on this forum (like me) are other students.

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 26, 2022, 5:31am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/10 "2022-08-26T05:31:29Z")

</div>

@codewithmosh  
Team please trace the fault in my case and tell me if it is a matter of software version or not  
I repeat : I followed the tutorial step by step especially (pipenv install django==2.1)

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [August 27, 2022, 12:38am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/11 "2022-08-27T00:38:56Z")

</div>

What does your admin.py file look like? Perhaps you can copy/paste the contents of your admin.py and models.py files into codeblocks:

```auto
def some_function():
  """Like this."""

```

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 27, 2022, 5:09am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/12 "2022-08-27T05:09:47Z")

</div>

below , I will paste the codes of admin and models files in two separate comments in the following order :  
content of admin.py file  
content of models.py file

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 27, 2022, 5:10am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/13 "2022-08-27T05:10:53Z")

</div>

from lib2to3.pgen2.token import GREATER  
from django.contrib import admin  
from .models import Genre, Movie

class GenreAdmin(admin.ModelAdmin):  
list\_display = (‘id’, ‘name’)

admin.site.register(Genre, GenreAdmin)  
admin.site.register(Movie)

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 27, 2022, 5:12am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/14 "2022-08-27T05:12:25Z")

</div>

from platform import release  
from turtle import title  
from django.db import models  
from django.utils import timezone

class Genre(models.Model):  
name = models.CharField(max\_length=255)

```
def __str__ (self):
    return self.name

```

class Movie(models.Model):  
title = models.CharField(max\_length=255)  
release\_year = models.IntegerField()  
number\_in\_stock = models.IntegerField()  
daily\_rate = models.FloatField()  
genre = models.ForeignKey(Genre, on\_delete=models.CASCADE)  
date\_created = models.DateTimeField(default=timezone.now)

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 27, 2022, 6:41am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/15 "2022-08-27T06:41:50Z")

</div>

![Screenshot (219)](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/8958a42df0758da8fd735eacd24b98263451f823.png)

---

<div class="post-metadata">

**Author:** ![ciglaxomrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/ciglaxomrey/32/4442_2.png) [@ciglaxomrey](https://forum.codewithmosh.com/u/ciglaxomrey)\
**Post date:** [August 27, 2022, 6:43am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/16 "2022-08-27T06:43:09Z")

</div>

![Screenshot (220)](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/38c07140bce7c79246f21e9b1de5af1aa881783c.png)

---

<div class="post-metadata">

**Author:** ![RaghadCoder](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@RaghadCoder](https://forum.codewithmosh.com/u/RaghadCoder)\
**Post date:** [September 2, 2022, 11:43pm UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/17 "2022-09-02T23:43:05Z")

</div>

I have same problem and I tried to fix it but I can’t, could anyone help us?

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [September 3, 2022, 1:35am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/18 "2022-09-03T01:35:08Z")

</div>

Your new error looks like a problem with needing to run using an elevated terminal (as in, running your terminal as an admin). I am not certain, just giving my best guess.

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [September 3, 2022, 1:35am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/19 "2022-09-03T01:35:40Z")

</div>

Which error @RaghadCoder ? The original error mentioned in the first post of this thread?

---

<div class="post-metadata">

**Author:** ![RaghadCoder](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@RaghadCoder](https://forum.codewithmosh.com/u/RaghadCoder)\
**Post date:** [September 3, 2022, 11:21am UTC](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619/20 "2022-09-03T11:21:49Z")

</div>

yes, it is the original error in the first post of this thread

[Next page](https://forum.codewithmosh.com/t/django-operational-error-no-such-table-main-auth-user-old/14619.md?page=2)
