アクセス許可を制限しないことの主な問題は、ユーザーができないはずのことを実行できるようになる可能性があることです。 たとえば、ユーザーが投稿を編集する権限を持っている場合、投稿を削除することもできます。
I have a problem with Django. I am using Django 1.8 and Python 3.4. I have created a superuser and staff user in my project, but the staff user is not restricting permission in django admin panel. I want to restrict the staff user from accessing some of the models in django admin panel, but it is not working for me, please help me out with this issue. A: You should add <code>is_staff = True</code> to your User model: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django-contrib-admin-models-logentry <blockquote> <p>The LogEntry model has two required fields:</p> <ul> <li><strong><code><code>user</code></code></strong>: The User that performed the action.</li> <li><strong><code><code>action_time</code></code></strong>: The timestamp of the action.</li> </ul> <p>[...]</p> <p>[...] If you want to log actions performed by non-staff users, you’ll need to set <a href="https://docs.djangoproject.com/en/1.8/_modules/django/contrib/auth/#User" rel="nofollow noreferrer"><strong><em><a href="https://docs.djangoproject.com/en/1.8/_modules/" rel="nofollow noreferrer">User.<strong></strong>.is_staff</a></em></strong></a>] to True.</p> </blockquote>
Django でのアクセス許可
Django のアクセス許可は、アプリで誰が何をできるかを制御する方法です。 これらは permissions.py ファイルで定義され、ユーザーごとまたはアプリごとに設定できます。
アクセス許可は、読み取りまたは書き込みのアクセス許可レベルで設定できます。 アクセス許可レベルは、すべてのユーザー、特定の役割のユーザーのみ、または特定のアクセス許可を持つユーザーのみを許可するように設定することもできます。
DJANGO_SETTINGS_MODULE 環境変数を使用して、アプリが行うすべてのリクエストのアクセス許可を設定することもできます。