Add my-orders page in account
This commit is contained in:
@@ -20,11 +20,6 @@ from . import views
|
||||
urlpatterns = [
|
||||
path('register', views.register, name='register'),
|
||||
path('profile/', views.profile, name='profile'),
|
||||
# path('account', views.account, name='account'),
|
||||
# path('account_<str:action>', views.account_action, name='account_action'),
|
||||
#
|
||||
# path('catalog/', views.catalog, name='catalog'),
|
||||
# path('catalog/<int:product_id>/', views.product_view, name='product_view'),
|
||||
# path('cart', views.cart, name='cart'),
|
||||
path('my-orders/', views.my_orders, name='my-orders'),
|
||||
]
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseRedirect
|
||||
from .forms import SiteUserForm
|
||||
from order.models import *
|
||||
from django.contrib.auth import login, authenticate
|
||||
|
||||
|
||||
def index(request):
|
||||
return render(request, 'profile.html')
|
||||
return render(request, 'account/profile.html')
|
||||
|
||||
|
||||
def register(request):
|
||||
@@ -25,4 +27,11 @@ def register(request):
|
||||
|
||||
|
||||
def profile(request):
|
||||
return render(request, 'profile.html')
|
||||
return render(request, 'account/profile.html')
|
||||
|
||||
|
||||
@login_required
|
||||
def my_orders(request):
|
||||
orders = Order.objects.filter(owner_id=request.user.id).select_related('address_city')
|
||||
|
||||
return render(request, 'account/my-orders.html', {"orders": orders})
|
||||
|
Reference in New Issue
Block a user