From b45660fbcf5dd22188354bfa0193845e568bda53 Mon Sep 17 00:00:00 2001 From: Mole Shang <135e2@135e2.dev> Date: Sat, 24 Jan 2026 19:47:41 +0800 Subject: initial commit --- store/templates/store/.book_list.html.kate-swp | 0 store/templates/store/add_edit_book.html | 84 ++++++++++ store/templates/store/base.html | 83 ++++++++++ store/templates/store/book_detail.html | 69 ++++++++ store/templates/store/book_list.html | 221 +++++++++++++++++++++++++ store/templates/store/cart.html | 52 ++++++ store/templates/store/checkout.html | 47 ++++++ store/templates/store/delete_book_confirm.html | 16 ++ store/templates/store/import_books.html | 46 +++++ store/templates/store/login.html | 32 ++++ store/templates/store/order_list.html | 56 +++++++ store/templates/store/order_management.html | 111 +++++++++++++ store/templates/store/profile.html | 39 +++++ store/templates/store/register.html | 49 ++++++ 14 files changed, 905 insertions(+) create mode 100644 store/templates/store/.book_list.html.kate-swp create mode 100644 store/templates/store/add_edit_book.html create mode 100644 store/templates/store/base.html create mode 100644 store/templates/store/book_detail.html create mode 100644 store/templates/store/book_list.html create mode 100644 store/templates/store/cart.html create mode 100644 store/templates/store/checkout.html create mode 100644 store/templates/store/delete_book_confirm.html create mode 100644 store/templates/store/import_books.html create mode 100644 store/templates/store/login.html create mode 100644 store/templates/store/order_list.html create mode 100644 store/templates/store/order_management.html create mode 100644 store/templates/store/profile.html create mode 100644 store/templates/store/register.html (limited to 'store/templates') diff --git a/store/templates/store/.book_list.html.kate-swp b/store/templates/store/.book_list.html.kate-swp new file mode 100644 index 0000000..e69de29 diff --git a/store/templates/store/add_edit_book.html b/store/templates/store/add_edit_book.html new file mode 100644 index 0000000..c87a9c7 --- /dev/null +++ b/store/templates/store/add_edit_book.html @@ -0,0 +1,84 @@ +{% extends 'store/base.html' %} +{% load static %} + +{% block content %} +
+ +

{{ title }}

+
+ {% csrf_token %} + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} + + {% for field in form %} + {% if field.name != 'cover_url' and field.name != 'cover_upload' %} +
+ +
+ {% endif %} + {% endfor %} + + + URL + File Upload + + +
+ +
+
+ +
+ + {% if form.cover_url.errors or form.cover_upload.errors or form.non_field_errors %} +
+ {{ form.cover_url.errors }} + {{ form.cover_upload.errors }} + {{ form.non_field_errors }} +
+ {% endif %} + +
+ Cancel + Save +
+
+{% endblock %} + +{% block extra_script %} + +{% endblock %} diff --git a/store/templates/store/base.html b/store/templates/store/base.html new file mode 100644 index 0000000..18a9557 --- /dev/null +++ b/store/templates/store/base.html @@ -0,0 +1,83 @@ + + + + + + SEU Bookstore + + + + + + + + + + + SEU Bookstore + + + {% if user.is_authenticated and not user.avatar %}{{ user.username|first|upper }}{% endif %} + + {% if user.is_authenticated %} + Profile + Logout + {% else %} + Login + Register + {% endif %} + + + + + + Books + Cart + Orders + +
+ + {% if user.is_staff %} + Manage + {% endif %} +
+ + + +
+ {% block content %} + {% endblock %} +
+
+
+ + + {% block extra_script %}{% endblock %} + + + diff --git a/store/templates/store/book_detail.html b/store/templates/store/book_detail.html new file mode 100644 index 0000000..e9cc2b8 --- /dev/null +++ b/store/templates/store/book_detail.html @@ -0,0 +1,69 @@ +{% extends 'store/base.html' %} + +{% block content %} +
+
+ {% if book.cover %} + {{ book.title }} + {% else %} +
+ No Image Available +
+ {% endif %} +
+
+
+

{{ book.title }}

+

{{ book.author }}

+

Publisher: {{ book.publisher }}

+

ISBN: {{ book.isbn }}

+

Price: {{ book.price }}

+

Stock: {{ book.stock }}

+

{{ book.description|safe }}

+
+ +
+
+ {% csrf_token %} + + Add to Cart +
+ Back to List + + {% if user.is_staff %} + Edit + Delete + {% endif %} +
+
+
+ + + +
+

Comments

+ {% if user.is_authenticated %} +
+ {% csrf_token %} + + Post Comment +
+ {% else %} +

Login to post a comment.

+ {% endif %} + +
+ {% for comment in comments %} + +
+ {{ comment.user.username }} + {{ comment.createdAt|date:"M d, Y H:i" }} +
+
{{ comment.content }}
+
+ {% empty %} +

No comments yet.

+ {% endfor %} +
+
+{% endblock %} diff --git a/store/templates/store/book_list.html b/store/templates/store/book_list.html new file mode 100644 index 0000000..5d68340 --- /dev/null +++ b/store/templates/store/book_list.html @@ -0,0 +1,221 @@ +{% extends 'store/base.html' %} +{% load mathfilters %} +{% block content %} +
+
+

Books

+
+ Search + {% if user.is_staff %} + Import Books + Add Book + {% endif %} +
+
+ +
+ + Search + {% if query %} + Clear + {% endif %} +
+
+ +
+ {% for book in books %} + +
+ {% if book.cover %} + {{ book.title }} + {% else %} +
+ No Image +
+ {% endif %} + +
+
+

+ {{ book.title }} +

+

+ {{ book.author }} +

+
+ +
+ {{ book.price }}¥ +
+
+ {% csrf_token %} + Add to Cart +
+
+
+
+
+
+ {% empty %} +
+ +
+

No books yet

+ {% if query %} +

We couldn't find any books matching "{{ query }}".

+ Clear Search + {% else %} +

Check back later!

+ {% endif %} +
+
+ {% endfor %} +
+ +{% if books.paginator.num_pages > 1 %} +
+
+
+ + {% if books.has_previous %}{{ books.number|sub:1 }}{% endif %} + +
+ +
+ + + of {{ books.paginator.num_pages }} + +
+ +
+ + {% if books.has_next %}{{ books.number|add:1 }}{% endif %} + +
+
+
+{% endif %} +{% endblock %} + +{% block extra_script %} + +{% endblock %} diff --git a/store/templates/store/cart.html b/store/templates/store/cart.html new file mode 100644 index 0000000..f634c58 --- /dev/null +++ b/store/templates/store/cart.html @@ -0,0 +1,52 @@ +{% extends 'store/base.html' %} + +{% block content %} +

Shopping Cart

+ {% if cart_items %} +
+ + + + + + + + + + + + {% for item in cart_items %} + + + + + + + + {% endfor %} + + + + + + + + +
BookPriceQuantityTotalActions
{{ item.book.title }}{{ item.book.price }}¥ +
+ {% csrf_token %} + + Update +
+
{{ item.total_price }}¥ + Remove +
Total:{{ total_price }}¥
+
+
+ Checkout +
+ {% else %} +

Your cart is empty.

+ Go Shopping + {% endif %} +{% endblock %} diff --git a/store/templates/store/checkout.html b/store/templates/store/checkout.html new file mode 100644 index 0000000..11dc99c --- /dev/null +++ b/store/templates/store/checkout.html @@ -0,0 +1,47 @@ +{% extends 'store/base.html' %} + +{% block content %} +

Checkout

+
+
+

Order Summary

+ + + + + + + + + + + {% for item in cart_items %} + + + + + + + {% endfor %} + + + + + + + +
BookPriceQuantityTotal
{{ item.book.title }}${{ item.book.price }}{{ item.quantity }}${{ item.total_price }}
Total:${{ total_price }}
+
+
+

Shipping Information

+
+ {% csrf_token %} +
+ +
+ Place Order +
+
+
+{% endblock %} + diff --git a/store/templates/store/delete_book_confirm.html b/store/templates/store/delete_book_confirm.html new file mode 100644 index 0000000..8450973 --- /dev/null +++ b/store/templates/store/delete_book_confirm.html @@ -0,0 +1,16 @@ +{% extends 'store/base.html' %} +{% load static %} + +{% block content %} +
+ +

Confirm Deletion

+

Are you sure you want to delete "{{ book.title }}"?

+
+ {% csrf_token %} + Cancel + Delete +
+
+
+{% endblock %} diff --git a/store/templates/store/import_books.html b/store/templates/store/import_books.html new file mode 100644 index 0000000..81d4f0e --- /dev/null +++ b/store/templates/store/import_books.html @@ -0,0 +1,46 @@ +{% extends 'store/base.html' %} +{% load static %} + +{% block content %} +
+ +

{{ title }}

+
+

Upload a JSONL file to import books. Each line should be a JSON object with a "metadata" key containing book details.

+
+
+ {% csrf_token %} + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} + +
+
+ + + Select JSONL File +
No file selected
+
+
+ +
+ Cancel + Import +
+
+
+
+{% endblock %} + +{% block extra_script %} + +{% endblock %} diff --git a/store/templates/store/login.html b/store/templates/store/login.html new file mode 100644 index 0000000..ff34b5e --- /dev/null +++ b/store/templates/store/login.html @@ -0,0 +1,32 @@ +{% extends 'store/base.html' %} +{% load static %} + +{% block content %} +
+ +

Login

+
+ {% csrf_token %} + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} + +
+ +
+
+ +
+ + Login +
+
+

Don't have an account? Register

+
+
+
+{% endblock %} diff --git a/store/templates/store/order_list.html b/store/templates/store/order_list.html new file mode 100644 index 0000000..c45680e --- /dev/null +++ b/store/templates/store/order_list.html @@ -0,0 +1,56 @@ +{% extends 'store/base.html' %} + +{% block content %} +

My Orders

+ {% if orders %} + + {% for order in orders %} + + + Order #{{ order.id }} - {{ order.createdAt|date:"M d, Y" }} - {{ order.total_price }}¥ - + {% if order.status == 1 %} + Pending + {% elif order.status == 2 %} + Shipped + {% elif order.status == 3 %} + Rejected + {% endif %} + +
+

Shipping Address: {{ order.address }}

+ + + + + + + + + + + {% for item in order.items.all %} + + + + + + + {% endfor %} + +
BookPriceQuantitySubtotal
{{ item.book.title }}{{ item.bookPrice }}¥{{ item.amount }}{{ item.total_price }}¥
+
+
+ {% endfor %} +
+ {% else %} +

You haven't placed any orders yet.

+ {% endif %} +{% endblock %} + diff --git a/store/templates/store/order_management.html b/store/templates/store/order_management.html new file mode 100644 index 0000000..18b6e4b --- /dev/null +++ b/store/templates/store/order_management.html @@ -0,0 +1,111 @@ +{% extends 'store/base.html' %} + +{% block content %} +

Order Management

+ +
+ + + + + + + + + + + + + + + {% for order in orders %} + + + + + + + + + + + + + + {% endfor %} + +
IDBuyerAddressDateTotalStatusActions
#{{ order.id }}{{ order.buyer.username }} +
+ {{ order.address }} +
+
{{ order.createdAt|date:"M d, Y H:i" }}${{ order.total_price }} + {% if order.status == 1 %} + Pending + {% elif order.status == 2 %} + Shipped + {% elif order.status == 3 %} + Rejected + {% endif %} + +
+ {% if order.status == 1 %} +
+ {% csrf_token %} + + +
+
+ {% csrf_token %} + + +
+ {% else %} + {{ order.get_status_display }} + {% endif %} +
+
+ +
+
+{% endblock %} + +{% block extra_script %} + +{% endblock %} diff --git a/store/templates/store/profile.html b/store/templates/store/profile.html new file mode 100644 index 0000000..d06cc7e --- /dev/null +++ b/store/templates/store/profile.html @@ -0,0 +1,39 @@ +{% extends 'store/base.html' %} + +{% block content %} +
+ +

User Profile

+ +
+ {% csrf_token %} +
+ {% if user.avatar %} + Avatar + {% else %} +
+ {{ user.username|first|upper }} +
+ {% endif %} +
+ +
+
+ + +
+ + + + + + +
+ +
+ Update Profile +
+
+
+
+{% endblock %} diff --git a/store/templates/store/register.html b/store/templates/store/register.html new file mode 100644 index 0000000..3d68916 --- /dev/null +++ b/store/templates/store/register.html @@ -0,0 +1,49 @@ +{% extends 'store/base.html' %} +{% load static %} + +{% block content %} +
+ +

Register

+
+ {% csrf_token %} + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} + + {% for field in form %} +
+ + {% if field.help_text %} + {{ field.help_text }} + {% endif %} + + {% if field.errors %} +
+ {% for error in field.errors %} + {{ error }} + {% endfor %} +
+ {% endif %} +
+ {% endfor %} + + Register +
+
+

Already have an account? Login

+
+
+
+{% endblock %} -- cgit v1.2.3