Reputation: 1877
How does Django framework make initial tables?
If you make Django project and run migrate, it makes tables like below. Even thought you didn't make any apps in project or didn't write any code in models.py for each app.
auth_group
auth_group_permissions
auth_permission
auth_user
auth_user_groups
auth_user_user_permissions
django_admin_log
django_content_type
django_migrations
django_session
I understood what ORM, MTV, migrations are. I want to figure out what in Django made those initial tables.
Addition Question:
I understand that I can control default permissions or custom permission in Meta class. If I don't set any, it makes three default permissions (add,change,delete).
When I migrate as I told you above, I can check those in a table named 'auth_permission'. There are records which is made initially
1;"Can add log entry";1;"add_logentry"
2;"Can change log entry";1;"change_logentry"
3;"Can delete log entry";1;"delete_logentry"
4;"Can add permission";2;"add_permission"
5;"Can change permission";2;"change_permission"
6;"Can delete permission";2;"delete_permission"
7;"Can add user";3;"add_user"
8;"Can change user";3;"change_user"
9;"Can delete user";3;"delete_user"
10;"Can add group";4;"add_group"
11;"Can change group";4;"change_group"
12;"Can delete group";4;"delete_group"
13;"Can add content type";5;"add_contenttype"
14;"Can change content type";5;"change_contenttype"
15;"Can delete content type";5;"delete_contenttype"
16;"Can add session";6;"add_session"
17;"Can change session";6;"change_session"
18;"Can delete session";6;"delete_session"
How can I manipulate those? E.g. What if I want to change the code names or what if I don't want to make default permissions (add,change,delete)?
Upvotes: 2
Views: 2071
Reputation: 1691
There are apps that are included in the project by default. You can see this is the INSTALLED_APPS
in the settings.py
file of your project. auth_group
is a table from django.contrib.auth
.
Upvotes: 1