Задать вопрос

Тел: +7 965 3737 888

442

Просмотров

0

Ответов

restrict user access to modeladmin via metaclass

<ul><li>
<p>Include __metaclass__ = user_lock to your ModelAdmin class</p>
</li>
<li>
<p>Add __target__ = path_to_user_field somewhere in the ModelAdmin</p>
</li>
<li>
<p>done!</p>
</li>
</ul><p>__target__ is what will be used in the filter call. examples 'user' or 'author' or 'message__user' e.t.c.</p>
<p>The result of __target__ is the field that is then checked against request.user</p>

Вопрос полезен? Да0/Нет0
file_4731.py(466.0б)
None