add a redirct view mixin

This commit is contained in:
Ross
2024-08-12 11:58:28 +01:00
parent 8beb6890a7
commit c2185f73a6
8 changed files with 126 additions and 106 deletions
+10
View File
@@ -186,6 +186,16 @@ class QuestionBase(models.Model, AuthorMixin, QuestionMixin):
"""If this makes sense in the question/answer context override"""
return None
def can_edit(self, user: User) -> bool:
"""Returns True if the user can edit the question"""
if user.is_superuser:
return True
if user in self.get_author_objects():
return True
return False
class SeriesImageBase(models.Model):
"""