diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 00e611d..12d9c9b 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 1db02a9..ca1a7d2 100644 --- a/config/settings.py +++ b/config/settings.py @@ -77,7 +77,7 @@ ROOT_URLCONF = 'config.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [BASE_DIR / 'core/templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -223,4 +223,4 @@ if HOST_FQDN: else: SITE_URL = HOST_FQDN else: - SITE_URL = "http://127.0.0.1:8000" + SITE_URL = "http://127.0.0.1:8000" \ No newline at end of file diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index 3e79ad8..b31aa6c 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index ba0c67c..474c9c9 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1c7d029..a24cde7 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index c579958..63389ef 100644 --- a/core/admin.py +++ b/core/admin.py @@ -8,7 +8,7 @@ from django.shortcuts import render from django.utils.html import format_html from django.contrib import messages from .whatsapp_utils import send_whatsapp_message_detailed -from django.core.mail import send_mail +from django.core.mail import send_html_email from django.conf import settings from .mail import send_html_email import logging @@ -172,3 +172,6 @@ admin.site.register(Governate) admin.site.register(City) admin.site.register(PlatformProfile, PlatformProfileAdmin) admin.site.register(Testimonial, TestimonialAdmin) + +# Set custom admin index template +admin.site.index_template = 'admin/dashboard.html' \ No newline at end of file diff --git a/core/forms.py b/core/forms.py index a54caaa..255ed32 100644 --- a/core/forms.py +++ b/core/forms.py @@ -335,3 +335,8 @@ class DriverRatingForm(forms.ModelForm): 'rating': _('Rating'), 'comment': _('Comment'), } + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # Reverse choices for CSS star rating logic (5 to 1) to ensure left-to-right filling + self.fields['rating'].choices = [(i, str(i)) for i in range(5, 0, -1)] \ No newline at end of file diff --git a/core/templates/admin/index.html b/core/templates/admin/dashboard.html similarity index 100% rename from core/templates/admin/index.html rename to core/templates/admin/dashboard.html diff --git a/core/templates/core/rate_driver.html b/core/templates/core/rate_driver.html index 4b18d6c..bcee138 100644 --- a/core/templates/core/rate_driver.html +++ b/core/templates/core/rate_driver.html @@ -25,7 +25,7 @@ {% for radio in form.rating %} {{ radio.tag }} {% endfor %} @@ -87,40 +87,5 @@ .rating-stars input[type="radio"]:checked ~ label { color: #ffc107; /* Bootstrap warning color (yellow) */ } - - /* Reverse order fix for logic but display is reversed, - so we might need to adjust logic or just use flex-direction: row-reverse - and ensure inputs are 5,4,3,2,1 order? - Django RadioSelect usually outputs in order 1,2,3,4,5. - If we reverse via flex, 1 is rightmost. That's wrong. - We need 1 on left. - - Actually simpler pure CSS rating usually involves flex-reverse. - Let's check Django output. - Django outputs 1, 2, 3, 4, 5. - If we use flex-direction: row-reverse, it shows 5 4 3 2 1. - Hovering 5 highlights 5, 4, 3, 2, 1. Correct. - - So visually: - [5] [4] [3] [2] [1] - - If I click left-most (5), it checks 5. - Wait, users expect [1] [2] [3] [4] [5]. - - If I use row-reverse: - DOM: 1 2 3 4 5 - Visual: 5 4 3 2 1 - - This is counter-intuitive for LTR. - - Let's use a different technique. - Use :checked ~ label selector, but then we need the input BEFORE the label. - Django widgets renders input then label? - {{ radio.tag }} is input.