viewهای Django¶
mixinهایی برای viewهای کلاسی Django، و یک decorator برای view تابعی. توضیحهای زیر از خود کد خوانده میشوند، و مثل کد به انگلیسیاند.
ScopedQuerySetMixin
¶
Narrows the view's queryset to the rows the person reaches for its action.
form_valid
¶
Django's CreateView and UpdateView: the row saved stays within
the scope. Its DeleteView: the rows a cascade takes are deletable too.
perform_destroy
¶
DRF's DestroyModelMixin: nothing a cascade takes is outside the delete scope.
perform_create
¶
DRF's CreateModelMixin: the row made is one the person may make.
perform_update
¶
DRF's UpdateModelMixin: the row is not edited out of the rows the person reaches.
require_written_within_scope
¶
obj - or each row of it, for a list saved at once - within the action's scope.
PolicyRequiredMixin
¶
Bases: AccessMixin
Asks the policy whether the person may do the view's action.
ProtectedFieldsViewMixin
¶
Builds the view's form for the person, and tells its template which fields they may see.
policy_required
¶
Let the view run only for somebody policy allows action.