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

Тел: +7 965 3737 888

542

Просмотров

1

Ответов

Generic views with row-level permission handling

<p>These generic views extend default views so that they also do permission checking on per-object basis. </p>
<ul><li>detail, update and delete - check access for user</li>
<li>create - create permissions for user on object</li>
<li>list - narrow object list with permissions</li>
</ul><p>Classes prefixed with Owned are example implementation where user has access to object if designed object attribute references him.</p>
<p>Example:</p>
<p>create_article = OwnedCreateView.as_view(owner='creator', model=Article, form_class=ArticleForm, success_url='/articles/article/%(id)d')</p>

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

Ответы (1):

Ответbradbeattie:15.06.2012
Ответ полезен? Да0/Нет0

To get this working, I had to modify getattr(object, "owner") and lookup_args = { "owner": user }.