I am trying to fetch a few rows from the DB using the following code in my
views.py:
from django.http import HttpResponsefrom django.shortcuts import renderfrom
fusioncharts.models import QRC_DB
def display_data(request,component):
query_results = QRC_DB.objects.get(component_name__contains=
如果您确定数据库中有数据的话,那么就是您该视图的url设计错误。Django数据库查询的get方法查询不到数据会报错。希望可以帮助到您。
ratnadeep ray 于2020年5月20日周三 下午4:16写道:
> I am trying to fetch a few rows from the DB using the following code in my
> views.py:
>
> from django.http import HttpResponsefrom django.shortcuts import renderfrom
> fusioncharts.mode
此处有语法错误: path('display_data/', views.display_data, name=
'display_data'),
正确的写法为:path(r'^display_data//$', views.display_data, name=
'display_data/'),
请记住,一定要加 /
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and
3 matches
Mail list logo