How to group model fields into certain group in django?
Answers
Answered by
1
Introduction to the Django user system
The Django user system is based on the django.contrib.auth package built-in to the Django framework. In this section you'll learn about the core concepts offered by this package, which is the default user system used by a variety of Django apps including the Django admin.
User types, sub-types, groups and permissions
There are two main types of Django user classes: User and AnonymousUser. If a user authenticates himself (i.e. provides a valid username/password) Django recognizes him as a User. On the other hand, if a user just surfs an application without any authentication, Django recognizes him as an AnonymousUser.
Any User can be further classified into one of various sub-types:
superuser.- The most powerful user with permissions to create, read, update and delete data in the Django admin, which includes model records and other users.
staff.- A user marked as staff can access the Django admin. But permissions to create, read, update and delete data in the Django admin must be given explicitly to a user. By default, a superuser is marked as staff.
active.- All users are marked as active if they're in good standing. Users marked as inactive aren't able to authenticate themselves, a common state if there's a pending post-registration step (e.g. confirm email) or a user is banned and you don't want to delete his data.
Django also offers the concept of a Group class to grant a set of users the same set of permissions without having to assign them individually. For example, you can grant permissions to a group and then assign users to the group to make permission management easier. In this manner, you can revoke or add permissions in a single step to a set of users, as well as quickly give new users the same permissions.
In addition, you can assign Django permissions granularly to a User orGroup in order for them to do CRUD(Create-Update-Delete) records on Django models, a process which is done through Permission model records. Or you can also assign coarser grained Django permissions on url/view methods or template content to grant access to a User, Group or even Permissionassignee.
Now that you know the basic concepts behind Django's user system, let's explore the more common operations associated with Django users in greater detail.
The Django user system is based on the django.contrib.auth package built-in to the Django framework. In this section you'll learn about the core concepts offered by this package, which is the default user system used by a variety of Django apps including the Django admin.
User types, sub-types, groups and permissions
There are two main types of Django user classes: User and AnonymousUser. If a user authenticates himself (i.e. provides a valid username/password) Django recognizes him as a User. On the other hand, if a user just surfs an application without any authentication, Django recognizes him as an AnonymousUser.
Any User can be further classified into one of various sub-types:
superuser.- The most powerful user with permissions to create, read, update and delete data in the Django admin, which includes model records and other users.
staff.- A user marked as staff can access the Django admin. But permissions to create, read, update and delete data in the Django admin must be given explicitly to a user. By default, a superuser is marked as staff.
active.- All users are marked as active if they're in good standing. Users marked as inactive aren't able to authenticate themselves, a common state if there's a pending post-registration step (e.g. confirm email) or a user is banned and you don't want to delete his data.
Django also offers the concept of a Group class to grant a set of users the same set of permissions without having to assign them individually. For example, you can grant permissions to a group and then assign users to the group to make permission management easier. In this manner, you can revoke or add permissions in a single step to a set of users, as well as quickly give new users the same permissions.
In addition, you can assign Django permissions granularly to a User orGroup in order for them to do CRUD(Create-Update-Delete) records on Django models, a process which is done through Permission model records. Or you can also assign coarser grained Django permissions on url/view methods or template content to grant access to a User, Group or even Permissionassignee.
Now that you know the basic concepts behind Django's user system, let's explore the more common operations associated with Django users in greater detail.
Similar questions