These are chat archives for django/django
Need some help with CBV and UserPassesTestMixin. I was going to use it to check if user is viewing his own page, using a simple test:
class DocBaseView(LoginRequiredMixin, UserPassesTestMixin, View): def test_func(self): return request.user.username == re.findall(r'/(w+)', request.path) class DocView(DocBaseView): # actual view code
The problem is that the test function doesn't have a request parameter and I don't understand if there is a pythonic way to make this check done. I have many views with this same check, so I wanted to define it in a parent class and keep the code from repeats. Anyone got any ideas of how it can be done?