Closed LordHandLee closed 7 months ago
Hi @LordHandLee, thank you for this pull request!
Could you please share your project's urls.py
setup? It looks to me like you may have added a namespace argument to include("guest_user.urls")
where it isn't required or supported.
There is no "core" namespace added to the patterns in django-guest-user
.
You may be right. However, in the past I had to add app_name = 'core' to my urls.py for my project to work. It has been a while since I did that so I forgot the reason for doing so. I included 'guest_user.urls' in my urls.py as outlined in the documentation and it gave me the NoReverseMatch error and so adding core: to {% url 'guest_user_convert' %} in convert_form fixed the error in my case.
from django.contrib.sitemaps.views import sitemap
from django.urls import path
from django.conf.urls import include
from .sitemap import StaticViewSitemap
from .views import (
ItemDetailView,
CheckoutView,
HomeView,
OrderSummaryView,
add_to_cart,
remove_from_cart,
remove_single_item_from_cart,
PaymentView,
AddCouponView,
RequestRefundView,
ScraperView,
DatasetView,
AboutView,
auth_scraper,
BTCPaymentView,
CashAppPaymentView,
SquarePaymentView,
CartridgeView,
CustomerOrderView,
OrderItemsView,
WhatisD8View,
D8DrugTestsView,
BatteryView,
StarterKitView,
ShippingMethodView,
BlogPageView,
BlogPostView,
upload_image,
VerifyView,
RefundPolicyView,
ContactUsView,
)
app_name = 'core'
urlpatterns = [
path('', HomeView.as_view(), name='home'),
path('checkout/', CheckoutView.as_view(), name='checkout'),
path('order-summary/', OrderSummaryView.as_view(), name='order-summary'),
path('product/<slug>/', ItemDetailView.as_view(), name='product'),
path('add-to-cart/<slug>/', add_to_cart, name='add-to-cart'),
path('add-coupon/', AddCouponView.as_view(), name='add-coupon'),
path('remove-from-cart/<slug>/', remove_from_cart, name='remove-from-cart'),
path('remove-item-from-cart/<slug>/', remove_single_item_from_cart,
name='remove-single-item-from-cart'),
path('payment/<payment_option>/', PaymentView.as_view(), name='payment'),
path('payments/square/', SquarePaymentView.as_view(), name='squarepayment'),
path('request-refund/', RequestRefundView.as_view(), name='request-refund'),
path('carts/', CartridgeView.as_view(), name='carts'),
path('batteries/', BatteryView.as_view(), name='batteries'),
path('starter_kits/', StarterKitView.as_view(), name='starter_kits'),
path('about/', AboutView.as_view(), name="about"),
path('refund_policy/', RefundPolicyView.as_view(),name="refund_policy"),
path('contact_us/', ContactUsView.as_view(), name="contact_us"),
path('auth/', auth_scraper, name='auth-scraper'),
path('btcpayment/', BTCPaymentView.as_view(), name='btcpayment'),
path('cashapppayment/', CashAppPaymentView.as_view(), name='cashapppayment'),
path('dashboard/', CustomerOrderView.as_view(), name='dashboard'),
path('view/<int:pk>/items/', OrderItemsView.as_view(), name="viewitems"),
path('blog/', BlogPageView.as_view(), name='blogpage'),
path('blog/<slug>/', BlogPostView.as_view(), name='blogpost'),
path('4465010ea3f1334e571ae90e87a1dec1.html', VerifyView.as_view(), name='verify'),
path("convert/", include("guest_user.urls")),
]
The app_name
variable is meant to be used in re-usable apps. Because you declare it here in your root URL config, all included apps are attached to it. You can try moving your own views into an app with app_name = "core"
and include that from your URL config separately.
Please check out the docs about URL namespaces.
I'm closing this PR but feel free to comment if you need additional help to get it working.
….2.*+
NoReverseMatch at /convert/
Reverse for 'guest_user_convert' not found. 'guest_user_convert' is not a valid view function or pattern name.
Updated convert_form.html to work with django versions 4.2.*+ and resolve the aforementioned error.