From 2fd139de554cd312051b16f323282d1f7210aaf6 Mon Sep 17 00:00:00 2001 From: yann Date: Mon, 8 Sep 2025 09:59:16 +0200 Subject: [PATCH] handle custom error templates --- lettings/models.py | 1 - lettings/views.py | 3 ++- oc-lettings-site.sqlite3 | Bin 151552 -> 159744 bytes oc_lettings_site/asgi.py | 2 +- oc_lettings_site/settings.py | 6 +++--- profiles/models.py | 1 - profiles/views.py | 3 ++- templates/404.html | 25 +++++++++++++++++++++++++ templates/500.html | 24 ++++++++++++++++++++++++ 9 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 templates/404.html create mode 100644 templates/500.html diff --git a/lettings/models.py b/lettings/models.py index aac0574..8e76ef0 100644 --- a/lettings/models.py +++ b/lettings/models.py @@ -20,4 +20,3 @@ class Letting(models.Model): def __str__(self): return self.title - diff --git a/lettings/views.py b/lettings/views.py index 5644333..c2dba21 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -7,10 +7,11 @@ def index(request): context = {'lettings_list': lettings_list} return render(request, 'lettings/index.html', context) + def letting(request, letting_id): letting = Letting.objects.get(id=letting_id) context = { 'title': letting.title, 'address': letting.address, } - return render(request, 'lettings/letting.html', context) \ No newline at end of file + return render(request, 'lettings/letting.html', context) diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 index 3d885414f9f3ed046704e8b09bdcd5c791c82d42..976ca88adbc3f5000d0c971401ae61a6fef5d8f5 100644 GIT binary patch delta 2055 zcmah~ZEO=|9KYx8`f@M5XJegPoP+D2Yxi>9bA4NHL`#JMTSTUi;0H-9TVV}jn`>c^ zXtpaeF(D?@8qWAZiJBP157s931Ikd0n)n6Gj6o+XyqKsT)Cigw4cb5Cq}Vho}!yA5RpzL$)nMV9#J_>{yM+~KG1KD#eDOrjc7TctJzbtgR^L=!xI;h<=HPL-9}d8EkcBtl zyYLI)4h)ynZ-ls;Zf&XhnRYw|Ejx4OR)MLJk*Rbx%NE1&OAqnFZ35napTjfo6wJdc zOvCLk1lK}FxLr~ggm?o_6Rj=Qs?528Gr$^`26iQAx)eh@FH?x`FFJ+>nq8uchM_&k4ze~RxfsXuTtYiQsF{E#i?*`L_mFYZn}`dGi%W?in# zq`;TJ9*WqTwt293WqKG)I+|Uhu1|r4_IsCW`Du0AKt!X)!OprW(_FZAcMx;}!*gq%+O+JcV9(ku ztj#^EJ*~@?O%vd=XDH-c)Et+c+=UWXU;;w$jswNwIF lf0q9@CR?clqhCf6ib}zlh?Kst+!u)klvp?x>wTLP{{w(3NyY#G delta 1003 zcmZp8z}c{XbAq&>6$1lMg05uH}H4!hwz*6OKfcX#}_Cgz--HypB$f)T2hjkmtGuSoLQ0@Ur>~v zmYI{vBEyeO7OIv_h7XJEWy86W<1U8~+bcE^)?DU;%zaFonIjn$`5rM` z;LYHh$Wz3t&3$`f<03YH3pVj&+v$BNj1u*@f+*e)myAL)zZtu@tu14#VM$_APAZ1F z#FUhx)Z$`X;_S{ru8twD3L%b8KCVIvO6cmgcPBBPV3go`&L9L!1rXZUlug`S5#(&y z?PV#9+3YMp@h=k_KWsP2VeDm$Yf`fWyQ?`KySt##i*6q*i6|nw3)5NC +
+
+

Error - 404

+

Page Not Found

+ +
+
+ + +
+
+

An error has occurred

+ + Back Home + +
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000..2b534f8 --- /dev/null +++ b/templates/500.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} +{% block title %}404 Not Found{% endblock title %} + +{% block content %} + +
+
+
+

Error - 500

+

Server Issue

+ +
+
+
+ + + +{% endblock %} \ No newline at end of file