Masalah utama kalayan henteu ngawatesan idin nyaéta yén éta tiasa nyababkeun pangguna tiasa ngalakukeun hal anu henteu kedah dilakukeun. Salaku conto, upami pangguna ngagaduhan idin pikeun ngédit pos, aranjeunna ogé tiasa ngahapus éta.
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>
Idin di Django
Idin di Django mangrupikeun cara pikeun ngontrol saha anu tiasa ngalakukeun naon sareng aplikasi anjeun. Éta ditetepkeun dina file permissions.py sareng tiasa disetél dina dasar per-pamaké atanapi per-aplikasi.
Idin tiasa disetél dina tingkat idin, boh maca atanapi nyerat. Tingkat idin ogé tiasa disetel pikeun ngawenangkeun sadaya pangguna, ngan ukur pangguna dina peran anu tangtu, atanapi ngan ukur pangguna anu gaduh idin anu tangtu.
Anjeun ogé tiasa nganggo variabel lingkungan DJANGO_SETTINGS_MODULE pikeun nyetél idin pikeun sadaya pamundut anu dilakukeun ku aplikasi anjeun.