How to update the model name in the permit (permission) from auth in Django?

Good day!
Recently, studying the list of permissions in the admin panel, I found that the names of the models in the permissions obsolete.
5c9a84ac8246e794578123.png
Here instead of the word Subject is the word Product, instead of the word Quantquant


I, without thinking, decided to look at database using DB Browser for SQLite (for SQLite browser) and found that the names of the models in the table permission (auth_permission) are stored directly in the database, and not taken from the code.
5c9a8b642bb7e276905175.png

From all the above I learned that the names of the models in permits was generalise the first migration.

Question: how to update model names in resolutions up to the current state?

Thanks in advance.
March 19th 20 at 08:44
1 answer
March 19th 20 at 08:46
Solution
In General, solved the problem as follows:
  1. Remove all permissions manually:
    • either via shell Django (python3 manage.py shell)
      from django.contrib.auth.models import Permission
      Permission.objects.all().delete()

    • either through a database tool (like DB Browser for SQLite) to find the table with the name auth_permission (you may have more) and delete all the entries to hell.

  2. To make and apply the migration:
    python3 manage.py makemigrations
    python3 manage.py migrate

Find more questions by tags Django