I use django-role-permission library for use roles and I have CreateView:
class CreatePostView(CreateView):
model = apps.blog.models.Post
form_class = PostForm
template_name = 'cabinet/post/create.html'
success_url = "/cabinet/post"
And I want this view can access only user with role: edit_posts