0

我正在使用 django-rest-framework-datatables 和 djongo 到 mongodb 的连接。我在使用搜索字段时遇到了问题。请问你能帮帮我吗 ?谢谢!

/app/data/ 处的数据库错误

子 SQL:无 FAILED SQL:SELECT COUNT(*) FROM (SELECT DISTINCT "app_person"."id" AS Col1, "app_person"."Name" AS Col2, "app_person"."Surname" AS Col3, "app_person". "BirthDate" AS Col4, "app_person"."Sex" AS Col5 FROM "app_person" WHERE ("app_person"."Name" iLIKE %(0)s OR "app_person"."Surname" iLIKE %(1)s))子查询参数: ('%A%', '%A%')

我有以下代码:

视图.py

class PersonViewSet(viewsets.ModelViewSet):
      queryset = Person.objects.all()
      serializer_class = PersonSerializer

.html

      $(document).ready(function() {
      $('#model').DataTable({
          'serverSide': true,
          'stateSave': true,  //restore table state on page reload,
          'searching': true,
          'ajax': '/app/data/?format=datatables',
          'columns': [
              {'data': 'Name', 'name': 'Name'},
              {'data': 'Surname', 'name': 'Surname'},
              {'data': 'BirthDate', 'searchable': false},
          ]

      });
  });
4

0 回答 0