...?
This commit is contained in:
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
|
from typing import List
|
||||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@@ -13,9 +14,9 @@ class AuthorMixin():
|
|||||||
requires an author many to many field to be defined on the derived class
|
requires an author many to many field to be defined on the derived class
|
||||||
|
|
||||||
"""
|
"""
|
||||||
author: models.ManyToManyField(User) # Is this correct typing?
|
author = models.ManyToManyField(User) # Corrected typing
|
||||||
|
|
||||||
def get_author_objects(self) -> list[User]:
|
def get_author_objects(self) -> List[User]: # Updated type hint
|
||||||
"""Returns list of author objects"""
|
"""Returns list of author objects"""
|
||||||
authors = [i for i in self.author.all()]
|
authors = [i for i in self.author.all()]
|
||||||
return authors
|
return authors
|
||||||
|
|||||||
Reference in New Issue
Block a user