Django: How to restrict access to views based on more than one condition

I'm already using UserPassesTestMixin with 1 test_func (as seen in the snippet from comments/ below). I'd like to incorporate another condition which is based on a boolean field in the user model: is_creator (snippet below from accounts/

# comments/ 

class CommentUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView):  # new
    model = Comment
    fields = (
    template_name = "comments/comment_update.html"

    def test_func(self):
        return self.request.user == self.object.owner
# accounts/

class CustomUser(AbstractUser):
    is_creator = models.BooleanField(default=False)

I know I can create a custom decorator (function view)/mixins (class views) and slap it on/into the view I'd like to add the restriction to, but I was wondering if I have other options.

Thanks in advance!

Back to Top