kadenios/faqs/mixins.py

15 lines
379 B
Python
Raw Normal View History

2021-06-15 11:41:04 +02:00
from django.contrib.auth.mixins import PermissionRequiredMixin
class AdminOnlyMixin(PermissionRequiredMixin):
"""Restreint l'accès aux admins"""
2021-07-13 02:41:32 +02:00
permission_required = "faqs.faq_admin"
2021-06-15 11:41:04 +02:00
class CreatorOnlyMixin(AdminOnlyMixin):
"""Restreint l'accès à l'auteur"""
def get_queryset(self):
return super().get_queryset().filter(author=self.request.user)