Coverage for apps/comments_views/core/mixins.py: 94%

12 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-06-19 08:36 +0000

1from abc import ABC 

2from abc import abstractmethod 

3 

4from django.contrib.auth.models import AbstractBaseUser 

5from django.contrib.auth.models import AnonymousUser 

6 

7from .rights import AbstractUserRights 

8 

9 

10class AbstractCommentRightsMixin(ABC): 

11 @property 

12 @abstractmethod 

13 def rights_class(self) -> type[AbstractUserRights]: 

14 pass 

15 

16 def get_rights(self, user: AbstractBaseUser | AnonymousUser) -> AbstractUserRights: 

17 return self.rights_class(user)