如何解决我在Django的动态网址系统中遇到问题
我一直在关注youtube上的其他教程,以构建某种项目。尝试寻找问题的解决方法已经有几天了
我尝试使用'str'和'int'
from django.urls import path
from . import views
urlpatterns = [
path('',views.home),path('products/',views.products),path('customer/<int:my_id>/',views.customer),]
这是我在views.py中的代码
def customer(request,my_id):
customer = Customer.objects.get(id=my_id)
orders = customer.order_set.all()
context = {'customer': customer,'orders': orders}
return render(request,'accounts/customer.htm',context)
请帮助
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。