Add author validation in collection_take_start and implement is_author method in AuthorMixin

This commit is contained in:
Ross
2025-09-15 11:31:05 +01:00
parent 0b12d95bdd
commit de8050a8ca
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -2125,6 +2125,9 @@ def collection_take_start(request, pk, cid=None, passcode=None):
valid_user = False
#valid_user = collection.check_logged_in_user(request)
if not valid_user and collection.is_author(request.user):
valid_user = True
cid_exam = None
+4
View File
@@ -63,6 +63,10 @@ class AuthorMixin():
"""Remove an author from the object"""
self.author.remove(user)
def is_author(self, user: User) -> bool:
"""Returns True if the user is an author of the object"""
return self.author.filter(id=user.id).exists()
class UserConfigurablePaginationMixin:
default_per_page = 25