Add views and their URLconf mapping
parent
3ec3ddbbe8
commit
967fd4d55d
@ -1,3 +1,23 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
import wishlist.models as m
|
||||||
|
import django.views.generic as dv
|
||||||
|
|
||||||
# Create your views here.
|
class WishedItemView(dv.DetailView):
|
||||||
|
model = m.WishedItem
|
||||||
|
template_name = ...
|
||||||
|
|
||||||
|
class UserWishLists(dv.ListView):
|
||||||
|
model = m.WishList
|
||||||
|
template_name = ...
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
qs = super().get_queryset()
|
||||||
|
return qs.filter(owner__login=self.loginname)
|
||||||
|
|
||||||
|
class WishListView(dv.ListView):
|
||||||
|
model = m.WishedItem
|
||||||
|
template_name = ...
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
qs = super().get_queryset()
|
||||||
|
return qs.filter(wishlists__slug__in=[self.slug])
|
||||||
|
Loading…
Reference in New Issue