Hello everyone,
I have a problem with a function that seems simple to me from Django, which is adding or modifying a Model in an application.
To add a model in an already existing application with tables already migrated, I follow the following steps:
1 - I create the new class, after the others, in my models.py file
2 - I add the line admin.site.register(myNewModel)
in admin.py
3 - I run a python manage.py makemigrations myApp
and I can see my table in the text that appears.
4 - Then a python manage.py migrate myApp
Then I open my admin space of the project and I see that the new table is present, except that when I click on it I have an error page
OperationalError at/admin/myApp/myNewModel/
no such table: myApp_myNewModel
and also it is impossible to add anything in, it’s actually not created…
I have been searching for a long time and what works is to completely delete my database before launching a makemigrations/migrate but I would like to find a less radical solution.
I have Django 4.0.3 and the base is the default is in sqlite3.
Thank you in advance for your answers, do not hesitate if you need more information.