# Admin console error

**URL:** <https://forum.djangoproject.com/t/admin-console-error/34726>\
**Category:** Mystery Errors\
**Created:** [September 12, 2024, 12:46pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726 "2024-09-12T12:46:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![adlante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adlante/32/23575_2.png) [@adlante](https://forum.djangoproject.com/u/adlante)\
**Post date:** [September 12, 2024, 12:46pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/1 "2024-09-12T12:46:32Z")

</div>

this is my models code

```auto
class Services(models.Model):
    title = models.CharField(max_length=100, verbose_name="title")
    title_en = models.CharField(max_length=100, verbose_name="title_en")

    class Meta:
        ordering = ['title']
        verbose_name = "services"

    def __str__ (self):
        return self.title

```

and i add new rows

```auto
class Services(models.Model):
    title = models.CharField(max_length=100, verbose_name="title")
    title_en = models.CharField(max_length=100, verbose_name="title_en")
    title_head = models.CharField(max_length=100, verbose_name="title_head")
    title_de = models.CharField(max_length=100, verbose_name="title_de")
    class_icon = models.CharField(max_length=100, verbose_name="class_icon")

    class Meta:
        ordering = ['title']
        verbose_name = "services"

    def __str__ (self):
        return self.title

```

In the first case, the admin was working fine, but when I added three new lines, it gives this error

…

# OperationalError at /admin/blog/services/

no such column: blog\_services.title\_head

| Request Method: | GET |
| --- | --- |
| Request URL: | [http://127.0.0.1:8000/admin/blog/services/](http://127.0.0.1:8000/admin/blog/services/) |
| Django Version: | 5.1.1 |
| Exception Type: | OperationalError |
| Exception Value: | no such column: blog\_services.title\_head |
| Exception Location: | C:\Users\adel\Desktop\djangoTour.venv\Lib\site-packages\django\db\backends\sqlite3\base.py, line 354, in execute |
| Raised during: | django.contrib.admin.options.changelist\_view |
| Python Executable: | C:\Users\adel\Desktop\djangoTour.venv\Scripts\python.exe |
| Python Version: | 3.12.4 |
| Python Path: | ``` |
| [‘C:\Users\adel\Desktop\djangoTour’, | |
| 'C:\Program Files\JetBrains\PyCharm ’ | |
| ‘2024.1.4\plugins\python\helpers\pycharm’, | |
| ‘C:\Users\adel\Desktop\djangoTour’, | |
| ‘C:\Users\adel\AppData\Local\Programs\Python\Python312\python312.zip’, | |
| ‘C:\Users\adel\AppData\Local\Programs\Python\Python312\DLLs’, | |
| ‘C:\Users\adel\AppData\Local\Programs\Python\Python312\Lib’, | |
| ‘C:\Users\adel\AppData\Local\Programs\Python\Python312’, | |
| ‘C:\Users\adel\Desktop\djangoTour\.venv’, | |
| ‘C:\Users\adel\Desktop\djangoTour\.venv\Lib\site-packages’] | |

```auto
|Server time:|Thu, 12 Sep 2024 12:45:33 +0000|

It means that it cannot create new codes in the console, please help
```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 12, 2024, 2:45pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/2 "2024-09-12T14:45:54Z")

</div>

After adding the new fields, did you do a `makemigrations` and `migrate` to update the database?

---

<div class="post-metadata">

**Author:** ![adlante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adlante/32/23575_2.png) [@adlante](https://forum.djangoproject.com/u/adlante)\
**Post date:** [September 12, 2024, 4:26pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/3 "2024-09-12T16:26:14Z")

</div>

Hello, yes sir, I did these things

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 12, 2024, 4:32pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/4 "2024-09-12T16:32:53Z")

</div>

Please show the output of a `showmigrations` command. Then post the contents of the migration file that is to add the fields to that model.

Side note: When posting errors, please post the error message and traceback from the runserver console, _not_ the error messages posted in the browser.

---

<div class="post-metadata">

**Author:** ![adlante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adlante/32/23575_2.png) [@adlante](https://forum.djangoproject.com/u/adlante)\
**Post date:** [September 12, 2024, 7:03pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/5 "2024-09-12T19:03:14Z")

</div>

```auto
manage.py@djangoTour > makemigrations
C:\Users\adel\Desktop\djangoTour\.venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm 2024.1.4\plugins\python\helpers\pycharm\django_manage.py" makemigrations C:/Users/adel/Desktop/djangoTour
Tracking file by folder pattern: migrations
No changes detected

Process finished with exit code 0

```

this is makemigrations

```auto
Tracking file by folder pattern: migrations
No changes detected

```

this is migrate

```auto
C:\Users\adel\Desktop\djangoTour\.venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm 2024.1.4\plugins\python\helpers\pycharm\django_manage.py" migrate C:/Users/adel/Desktop/djangoTour
Tracking file by folder pattern: migrations
Operations to perform:
  Apply all migrations: admin, auth, blog, contenttypes, sessions
Running migrations:
  No migrations to apply.

Process finished with exit code 0
manage.py@djangoTour > runserver
C:\Users\adel\Desktop\djangoTour\.venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm 2024.1.4\plugins\python\helpers\pycharm\django_manage.py" runserver C:/Users/adel/Desktop/djangoTour
Tracking file by folder pattern: migrations
Performing system checks...

Watching for file changes with StatReloader
System check identified no issues (0 silenced).
September 12, 2024 - 22:29:32
Django version 5.1.1, using settings 'djangoTour.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

```

runserver is ok

```
return super().execute(query, params)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

django.db.utils.OperationalError: no such table: blog\_servicescategory  
[12/Sep/2024 22:31:25] “GET /admin/blog/servicescategory/ HTTP/1.1” 500 196296

this is error after run server

---

<div class="post-metadata">

**Author:** ![adlante](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adlante/32/23575_2.png) [@adlante](https://forum.djangoproject.com/u/adlante)\
**Post date:** [September 12, 2024, 7:08pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/6 "2024-09-12T19:08:13Z")

</div>

I think the database has a problem that it cannot add new lines after creating a new line? Your opinion is respected

Because it gives this error in the admin console  
With this form in the browser

# OperationalError at /admin/blog/servicescategory/

no such table: blog\_servicescategory

| Request Method: | GET |
| --- | --- |
| Request URL: | [http://127.0.0.1:8000/admin/blog/servicescategory/](http://127.0.0.1:8000/admin/blog/servicescategory/) |
| Django Version: | 5.1.1 |
| Exception Type: | OperationalError |
| Exception Value: | no such table: blog\_servicescategory |
| Exception Location: | C:\Users\adel\Desktop\djangoTour.venv\Lib\site-packages\django\db\backends\sqlite3\base.py, line 354, in execute |
| Raised during: | django.contrib.admin.options.changelist\_view |
| Python Executable: | C:\Users\adel\Desktop\djangoTour.venv\Scripts\python.exe |
| Python Version: | 3.12.4 |

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 12, 2024, 8:34pm UTC](https://forum.djangoproject.com/t/admin-console-error/34726/7 "2024-09-12T20:34:58Z")

</div>

> [@KenWhitesell](#):
>
> Please show the output of a `showmigrations` command. Then post the contents of the migration file that is to add the fields to that model.

Please post the output of **`showmigrations`** (not `makemigrations` or `migrate`) and the content of the file in your apps `migrations` directory that has the migration information for this model for adding the files.

> [@adlante](#):
>
> django.db.utils.OperationalError: no such table: blog\_servicescategory  
> [12/Sep/2024 22:31:25] “GET /admin/blog/servicescategory/ HTTP/1.1” 500 196296
> 
> this is error after run server

This is just the last line, we would need to see the **complete** traceback.

Also, please post the `INSTALLED_APPS` section of your settings.py file.
