From 7cf53e9789d8c179a1facaa5f6831573505ab289 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 13 Mar 2026 19:29:03 +0000 Subject: [PATCH] version backend2 --- core/__pycache__/urls.cpython-311.pyc | Bin 1038 -> 1141 bytes core/__pycache__/views.cpython-311.pyc | Bin 5068 -> 4936 bytes core/templates/core/index.html | 128 +++++------------------- core/templates/core/product_detail.html | 23 +++++ core/urls.py | 5 +- core/views.py | 25 ++--- 6 files changed, 62 insertions(+), 119 deletions(-) create mode 100644 core/templates/core/product_detail.html diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index c0a7488945cd53b84b8f1f01fd04fd1c89dc0b9e..3518efb0949e258c49a118dbe11f75324ca6d271 100644 GIT binary patch delta 432 zcmeC<_{yQaoR^o20SKO?Y{^{6#K7Khn7&PBUWrvfww-nAf_Vj$%~jG zxuk(YAfFb?PG)5`(TKaiKopuB%`7c=fm3Ei-UVal3oI@dSzNBLxJ)i&?&Ig@;Ad*! K2Eigppuqr~6Ik2; delta 296 zcmey$(Z`{_oR^o20SHd*+nnjc#K7nmYbr+y+r$H+ z${av0a~4buLki~_u4Rl246A_{0#dj^%6NdvSdf<>Hye#s^f!%Ad-fA^>DC3#PJ7 z7GRW=7%Q6y8}o>z|Fiar{H<#KdiboekuN5E?*%mQtxjBp`)~3QNe^c$dUs?G3YQ z)I_Olq~72_m;;v{dVmm=azN>!Dwm!RNF40QQqfAefH-io1YCOJy|EnyBF6UTH*em& zpKsp#Irn2W^mQl{6kz?T-z$yogp%ZNCwIM89>@<6K^Jt%jFboSgCP5KzZosZ^09I} zA1^2J3D5;@3Hc}VAmETL111eg@4qGNg1>!q%2z%G+R!QOFlfW4v?DrsTTqFz^H)CR zaU-jSQ?ORnjUxQf!raUpdy6dP`oOOTet+%(d?7eIOb6CUZ*xav#2;hd`@`ZL4~TI# zFDuebvQ3--`_4a9)5Y83P0^8i7X)Ej&^_DYF1X%D_k2M%-mURvq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A!J*`!2?ugBS7aqii+PcG!gP$}g)C>0P#TA`^8)r| zXOVWG7%4-_*Bn}+SyUy*^l(H zIVVpIof5;OP3(|!DwJSJ)nf0Vx$#bJIu(zUPJ@&+_zo)JUOv*&nV)zsVH?INig-o&K&j>ROXs#F+x41OvyFE3Po5L%0~<@;!wB-`rMKiDmWFJ zHHsJX_e@722pvP{2XKP`DhxjhdKh_x{W!-Lqd&vekH-cA;$cn_8wvFD!q99+rNDSB zIXZqCJ^XO^TF?s!Qvh0+zK!xx059>vLvL)yH*Z+-Pm_mo|4UOrzhel;5yA-ga!?r| z#h)d$%s7fC5&XuK=|0|-daG{+89y(y#k`uC4dV>L$%i*mx5OR|M6Hv)j&v`8CpT^+ z#V3V!@NC*Kym*7lRTw-KjoTuZ9D{&@wV){kf4kW0e$)6xZ=55p_N_p1CI58)jvNE$ nibYP)kAcJHafkU|=>@)?Y3D1M!zo2PvLn2Ne!iJuL3IBI?2V-` diff --git a/core/templates/core/index.html b/core/templates/core/index.html index 5a817bd..1d9f8c7 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -2,109 +2,31 @@ {% block title %}Ethio-gebeya | Marketplace{% endblock %} -{% block head %} - -{% endblock %} - {% block content %} -
-
-

Welcome to Ethio-gebeya

-

A modern marketplace foundation with separate dashboards for buyers and sellers.

-
- {% if user.is_authenticated %} - Open Dashboard - Sign Out - {% else %} - Sign In - {% endif %} +
+

Welcome to Ethio-gebeya

+ +
+ {% for product in products %} +
+
+
+
{{ product.name }}
+

{{ product.description|truncatewords:20 }}

+

Price: {{ product.price }} ETB

+ View Details +
+
+
+ {% endfor %} +
+ +
+ {% if user.is_authenticated %} + Open Dashboard + {% else %} + Sign In + {% endif %}
-

Runtime: Django {{ django_version }} · Python {{ python_version }} · {{ current_time|date:"Y-m-d H:i:s" }} UTC

-
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/product_detail.html b/core/templates/core/product_detail.html new file mode 100644 index 0000000..e2fa822 --- /dev/null +++ b/core/templates/core/product_detail.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% block title %}{{ product.name }} | Ethio-gebeya{% endblock %} + +{% block content %} +
+
+
+

{{ product.name }}

+

{{ product.description }}

+

Price: {{ product.price }} ETB

+

Stock: {{ product.stock }}

+ +
+ {% csrf_token %} + +
+ + Back to catalog +
+
+
+{% endblock %} diff --git a/core/urls.py b/core/urls.py index dcd0911..1a873df 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,13 +1,14 @@ from django.urls import path from django.contrib.auth.views import LoginView, LogoutView -from .views import buyer_dashboard, dashboard_redirect, home, seller_dashboard +from .views import buyer_dashboard, dashboard_redirect, home, product_detail, seller_dashboard urlpatterns = [ path("", home, name="home"), + path("product//", product_detail, name="product_detail"), path("login/", LoginView.as_view(template_name="core/login.html"), name="login"), path("logout/", LogoutView.as_view(next_page="home"), name="logout"), path("dashboard/", dashboard_redirect, name="dashboard"), path("dashboard/buyer/", buyer_dashboard, name="buyer_dashboard"), path("dashboard/seller/", seller_dashboard, name="seller_dashboard"), -] +] \ No newline at end of file diff --git a/core/views.py b/core/views.py index 4d00f97..6c06c6d 100644 --- a/core/views.py +++ b/core/views.py @@ -4,31 +4,28 @@ import platform from django import get_version as django_version from django.contrib.auth.decorators import login_required from django.db.models import Count, DecimalField, ExpressionWrapper, F, Sum -from django.shortcuts import redirect, render +from django.shortcuts import get_object_or_404, redirect, render from django.utils import timezone from .models import Order, OrderItem, Product def home(request): - """Render the landing screen with environment details.""" - host_name = request.get_host().lower() - agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" - now = timezone.now() - + """Render the product catalog landing page.""" + products = Product.objects.all().order_by('-created_at') + context = { - "project_name": "New Style", - "agent_brand": agent_brand, + "products": products, "django_version": django_version(), - "python_version": platform.python_version(), - "current_time": now, - "host_name": host_name, - "project_description": os.getenv("PROJECT_DESCRIPTION", ""), - "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), } return render(request, "core/index.html", context) +def product_detail(request, pk): + product = get_object_or_404(Product, pk=pk) + return render(request, "core/product_detail.html", {"product": product}) + + def _is_seller(user): return hasattr(user, "userprofile") and user.userprofile.is_seller @@ -90,4 +87,4 @@ def seller_dashboard(request): "total_revenue": sales_summary["total_revenue"] or 0, "recent_sales": recent_sales, } - return render(request, "core/seller_dashboard.html", context) + return render(request, "core/seller_dashboard.html", context) \ No newline at end of file