Filter bookmarks by user
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from django.utils import timezone
|
||||
from .models import Bookmark
|
||||
from django.views.generic.list import ListView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
||||
@@ -8,7 +8,10 @@ class BookmarkListView(LoginRequiredMixin, ListView):
|
||||
model = Bookmark
|
||||
paginate_by = 20
|
||||
|
||||
def get_queryset(self):
|
||||
return Bookmark.objects.filter(user_id=self.request.user.id)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['now'] = timezone.now()
|
||||
context['userid'] = self.request.user.id
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user