diff options
| author | Stephen James <StephenOrJames@users.noreply.github.com> | 2018-09-26 15:06:43 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-09-26 15:06:57 -0400 |
| commit | f5335bc745d4f86d355b69549712885fd1634574 (patch) | |
| tree | cb26bba6740cce5661ce1ed2be977ce539cfa4f8 /docs | |
| parent | 5aeced6dcd881dfe7413da5356be0e9f14da3d40 (diff) | |
[2.1.x] Fixed #29683 -- Added view permission to docs.
Backport of e40e7026cad400d720963aea0ba156a19f83b058 from master.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth/customizing.txt | 13 | ||||
| -rw-r--r-- | docs/topics/auth/default.txt | 4 | ||||
| -rw-r--r-- | docs/topics/testing/advanced.txt | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 8a7f3a9406..963bbd3176 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -273,14 +273,13 @@ Custom permissions To create custom permissions for a given model object, use the ``permissions`` :ref:`model Meta attribute <meta-options>`. -This example Task model creates three custom permissions, i.e., actions users -can or cannot do with Task instances, specific to your application:: +This example ``Task`` model creates two custom permissions, i.e., actions users +can or cannot do with ``Task`` instances, specific to your application:: class Task(models.Model): ... class Meta: permissions = ( - ("view_task", "Can see available tasks"), ("change_task_status", "Can change the status of tasks"), ("close_task", "Can remove a task by setting its status as closed"), ) @@ -289,11 +288,11 @@ The only thing this does is create those extra permissions when you run :djadmin:`manage.py migrate <migrate>` (the function that creates permissions is connected to the :data:`~django.db.models.signals.post_migrate` signal). Your code is in charge of checking the value of these permissions when a user -is trying to access the functionality provided by the application (viewing -tasks, changing the status of tasks, closing tasks.) Continuing the above -example, the following checks if a user may view tasks:: +is trying to access the functionality provided by the application (changing the +status of tasks or closing tasks.) Continuing the above example, the following +checks if a user may close tasks:: - user.has_perm('app.view_task') + user.has_perm('app.close_task') .. _extending-user: diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index a77fe9ad4c..234a698087 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -196,8 +196,8 @@ Default permissions ------------------- When ``django.contrib.auth`` is listed in your :setting:`INSTALLED_APPS` -setting, it will ensure that three default permissions -- add, change and -delete -- are created for each Django model defined in one of your installed +setting, it will ensure that four default permissions -- add, change, delete, +and view -- are created for each Django model defined in one of your installed applications. These permissions will be created when you run :djadmin:`manage.py migrate diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index 455c121acd..a3112fb367 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -249,7 +249,7 @@ Advanced features of ``TransactionTestCase`` By default, ``available_apps`` is set to ``None``. After each test, Django calls :djadmin:`flush` to reset the database state. This empties all tables and emits the :data:`~django.db.models.signals.post_migrate` signal, which - re-creates one content type and three permissions for each model. This + recreates one content type and four permissions for each model. This operation gets expensive proportionally to the number of models. Setting ``available_apps`` to a list of applications instructs Django to |
