add a list

This commit is contained in:
Flatlogic Bot 2026-02-01 17:33:49 +00:00
parent 4975582b68
commit 9f0927a406
5 changed files with 24 additions and 3 deletions

View File

@ -410,7 +410,7 @@
const errorMessage = document.getElementById('pricingErrorMessage');
if (pickupLat && pickupLng && deliveryLat && deliveryLng && weight) {
fetch('{% url "api_pricing" %}', {
fetch('{% url "api_calculate_price" %}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',

View File

@ -1,4 +1,5 @@
from django.urls import path
from django.contrib.auth import views as auth_views
from . import views, api_views
urlpatterns = [
@ -11,7 +12,7 @@ urlpatterns = [
path('login/', views.CustomLoginView.as_view(), name='login'),
path('login/2fa/select/', views.select_2fa_method, name='select_2fa_method'),
path('login/2fa/verify/', views.verify_2fa_otp, name='verify_2fa_otp'),
path('logout/', views.logout, name='logout'),
path('logout/', views.logout_view, name='logout'),
path('dashboard/', views.dashboard, name='dashboard'),
path('shipment-request/', views.shipment_request, name='shipment_request'),
@ -34,6 +35,12 @@ urlpatterns = [
path('rate-driver/<int:parcel_id>/', views.rate_driver, name='rate_driver'),
# Password Reset
path('password-reset/', auth_views.PasswordResetView.as_view(template_name='core/password_reset_form.html', email_template_name='core/emails/password_reset_email.html', subject_template_name='core/emails/password_reset_subject.txt'), name='password_reset'),
path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='core/password_reset_done.html'), name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='core/password_reset_confirm.html'), name='password_reset_confirm'),
path('password-reset-complete/', auth_views.PasswordResetCompleteView.as_view(template_name='core/password_reset_complete.html'), name='password_reset_complete'),
# OTP Login / Passwordless
path('ajax/request-login-otp/', views.request_login_otp, name='request_login_otp'),
path('ajax/verify-login-otp/', views.verify_login_otp, name='verify_login_otp'),
@ -61,6 +68,7 @@ urlpatterns = [
# API Endpoints (for Mobile App)
path('api/v1/parcels/', api_views.ParcelListCreateView.as_view(), name='api_parcel_list'),
path('api/v1/parcels/<int:pk>/', api_views.ParcelDetailView.as_view(), name='api_parcel_detail'),
path('api/v1/pricing/', api_views.PriceCalculatorView.as_view(), name='api_pricing'), path('api/v1/calculate-price/', api_views.PriceCalculatorView.as_view(), name='api_calculate_price'),
path('api/v1/pricing/', api_views.PriceCalculatorView.as_view(), name='api_pricing'),
path('api/v1/calculate-price/', api_views.PriceCalculatorView.as_view(), name='api_calculate_price'),
path('api/v1/profile/', api_views.UserProfileView.as_view(), name='api_profile'),
]

View File

@ -37,6 +37,11 @@ from io import BytesIO
import base64
from .pricing import get_pricing_breakdown # Import pricing logic
def logout_view(request):
logout(request)
messages.success(request, _("You have been logged out."))
return redirect("index")
def index(request):
# If tracking_id is present, redirect to the new track view
tracking_id = request.GET.get('tracking_id')
@ -338,6 +343,14 @@ def shipment_request(request):
platform_profile = PlatformProfile.objects.first()
google_maps_api_key = platform_profile.google_maps_api_key if platform_profile else None
# DEBUG: Verify reverse
try:
url1 = reverse('api_pricing')
url2 = reverse('api_calculate_price')
print(f"DEBUG REVERSE: api_pricing={url1}, api_calculate_price={url2}")
except Exception as e:
print(f"DEBUG REVERSE ERROR: {e}")
return render(request, 'core/shipment_request.html', {
'form': form,
'google_maps_api_key': google_maps_api_key