mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
forum: enhance performances on toggle_favorite
This commit is contained in:
parent
3eb8292d15
commit
321e5e3ff5
@ -280,7 +280,7 @@ class ForumTopicSubscribeView(CanViewMixin, SingleObjectMixin, RedirectView):
|
|||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
if request.user in self.object.subscribed_users.all():
|
if self.object.subscribed_users.filter(id=request.user.id).exists():
|
||||||
self.object.subscribed_users.remove(request.user)
|
self.object.subscribed_users.remove(request.user)
|
||||||
else:
|
else:
|
||||||
self.object.subscribed_users.add(request.user)
|
self.object.subscribed_users.add(request.user)
|
||||||
|
Loading…
Reference in New Issue
Block a user