This commit is contained in:
Ross
2024-02-05 09:37:13 +00:00
parent 6ac2743844
commit 269a86c25b
+3 -2
View File
@@ -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