from django.conf.urls.i18n import i18n_patterns from django.contrib.auth.decorators import login_required from django.urls import path from django.utils.text import gettext_lazy as _ from web.views.components import ( cart, cart_dropdown, list_customer_addresses_component, list_products, list_wishlisted_products, update_customer_address, user_info_component, wishlist_button, change_password_component, ) from web.views.web import ( add_cart_item, add_to_wishlist, cart_detail, category_view, delete_cart_item, delete_from_wishlist, index, manifest, order_detail, orders, product_detail, wishlist, ) app_name = 'web' i18n_resolvers = i18n_patterns( path('', index, name='index'), path(_('wishlist'), login_required(wishlist, login_url=_('/login/')), name='wishlist'), path(_('categories//'), category_view, name='category_view'), path(_('products///'), product_detail, name='product_detail'), path(_('cart/'), cart_detail, name='cart_detail'), path(_('orders/'), login_required(orders, login_url=_('/login/')), name='orders'), path(_('order//'), order_detail, name='order'), ) urlpatterns = [ # components path('web/components/products/', list_products, name='list_products'), path('web/components/wishlist/', list_wishlisted_products, name='list_wishlisted_products'), path('web/components/cart-dropdown/', cart_dropdown, name='cart_dropdown'), path('web/components/cart/', cart, name='cart'), path('web/components/wishlist-button//', wishlist_button, name='wishlist_button'), path( 'web/components/user-info/', login_required(user_info_component, login_url=_('/login/')), name='user_info_component', ), path( 'web/components/change-password/', login_required(change_password_component, login_url=_('/login/')), name='change_password_component', ), # api path('web/add-cart-item/', add_cart_item, name='add_cart_item'), path('web/delete-cart-item//', delete_cart_item, name='delete_cart_item'), path('web/add-to-wishlist/', add_to_wishlist, name='add_to_wishlist'), path('web/delete-from-wishlist//', delete_from_wishlist, name='delete_from_wishlist'), path('web/customer-address//', update_customer_address, name='update_customer_address'), path('web/customer-addresses/', list_customer_addresses_component, name='list_customer_addresses_component'), # manifest path('manifest.json', manifest, name='manifest_json'), ] for resolver in i18n_resolvers: urlpatterns += resolver.url_patterns