15 lines
379 B
Python
15 lines
379 B
Python
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||
|
|
||
|
|
||
|
class AdminOnlyMixin(PermissionRequiredMixin):
|
||
|
"""Restreint l'accès aux admins"""
|
||
|
|
||
|
permission_required = "faqs.is_author"
|
||
|
|
||
|
|
||
|
class CreatorOnlyMixin(AdminOnlyMixin):
|
||
|
"""Restreint l'accès à l'auteur"""
|
||
|
|
||
|
def get_queryset(self):
|
||
|
return super().get_queryset().filter(author=self.request.user)
|