From 5612f788da42bde5739a06fa2e3c413568a4b311 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 16 Feb 2021 04:45:31 +0100 Subject: [PATCH] Add templates for wishlist app --- wishlist/templates/wishlist/item.html | 7 +++++++ .../templates/wishlist/userwishlists.html | 13 +++++++++++++ wishlist/templates/wishlist/wishlist.html | 19 +++++++++++++++++++ wishlist/views.py | 6 +++--- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 wishlist/templates/wishlist/item.html create mode 100644 wishlist/templates/wishlist/userwishlists.html create mode 100644 wishlist/templates/wishlist/wishlist.html diff --git a/wishlist/templates/wishlist/item.html b/wishlist/templates/wishlist/item.html new file mode 100644 index 0000000..6ade95c --- /dev/null +++ b/wishlist/templates/wishlist/item.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% block content %} +

Item: {{ object.name }}

+ +

{{ object.description }}

+ +{% endblock %} diff --git a/wishlist/templates/wishlist/userwishlists.html b/wishlist/templates/wishlist/userwishlists.html new file mode 100644 index 0000000..2d5feac --- /dev/null +++ b/wishlist/templates/wishlist/userwishlists.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} +{% block content %} +

Wishlist of user {{ user }}

+{% if object_list %} + +{% else %} +

This wishlist is empty

+{% endif %} +{% endblock %} diff --git a/wishlist/templates/wishlist/wishlist.html b/wishlist/templates/wishlist/wishlist.html new file mode 100644 index 0000000..88a8504 --- /dev/null +++ b/wishlist/templates/wishlist/wishlist.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} +{% block content %} +

Wishlist {{ wishlist.name }}

+ +{% if wishlist.description %} +

{{ wishlist.description }}

+{% endif %} + +{% if object_list %} + +{% else %} +

This wishlist is empty

+{% endif %} +{% endblock %} diff --git a/wishlist/views.py b/wishlist/views.py index 9b18ac5..c82c833 100644 --- a/wishlist/views.py +++ b/wishlist/views.py @@ -4,11 +4,11 @@ import django.views.generic as dv class WishedItemView(dv.DetailView): model = m.WishedItem - template_name = ... + template_name = 'wishlist/item.html' class UserWishLists(dv.ListView): model = m.WishList - template_name = ... + template_name = 'wishlist/userwishlists.html' def get_queryset(self): qs = super().get_queryset() @@ -16,7 +16,7 @@ class UserWishLists(dv.ListView): class WishListView(dv.ListView): model = m.WishedItem - template_name = ... + template_name = 'wishlist/wishlist.html' def get_queryset(self): qs = super().get_queryset()