mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-13 06:06:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c24c0d3ac4 | ||
|
|
b560c6860b | ||
|
|
22b510e25b |
No files matched your search
+5
-2
@@ -346,13 +346,16 @@ class ForumTopicDetailView(CanViewMixin, DetailView):
|
||||
return kwargs
|
||||
|
||||
|
||||
class ForumMessageView(SingleObjectMixin, RedirectView):
|
||||
class ForumMessageView(SingleObjectMixin, UserPassesTestMixin, RedirectView):
|
||||
model = ForumMessage
|
||||
pk_url_kwarg = "message_id"
|
||||
permanent = False
|
||||
|
||||
def get_redirect_url(self, *args, **kwargs):
|
||||
def test_func(self) -> bool:
|
||||
self.object = self.get_object()
|
||||
return self.request.user.can_view(self.object)
|
||||
|
||||
def get_redirect_url(self, *args, **kwargs):
|
||||
return self.object.get_url()
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ tests = [
|
||||
"pytest>=9.1.1,<10.0.0",
|
||||
"pytest-cov>=7.1.0,<8.0.0",
|
||||
"pytest-django>=4.14.0,<5.0.0",
|
||||
"model-bakery>=1.24.1,<2.0.0",
|
||||
"model-bakery>=1.24.2,<2.0.0",
|
||||
"beautifulsoup4>=4.15.0,<5",
|
||||
"lxml>=6.1.3,<7",
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user