python 基本的django views.py函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 基本的django views.py函数相关的知识,希望对你有一定的参考价值。

# imported libraries

def helloworld(request):
  return render(request, "template.html", {"var_name": Model.objects.count()})
  # render(<arg 1>, <arg 2>, <arg 3>)
  # arg 1: request
  # arg 2: the html from template directory
  # arg 3: json object to be returned

以上是关于python 基本的django views.py函数的主要内容,如果未能解决你的问题,请参考以下文章