django表单
表单是交互性网站的支柱。 本文内容包括django对表单提交数据的访问,有效性检查以及其他处理,还有HttpRequest对象和Form对象。 一、HttpRequest的URL相关信息 定义views.py def current_url_view(request): return HttpResponse("Welcome to the page at %s,host is %s,full path is %s,is_secure is %s" % (request.path,request.get_host(),request.get_full_path(),request.is_secure())) 可以显示出: Welcome to the page at /url/,host is 10.1.101.227:9000,full path is /url/,is_secure is False 二、request.META 显示所有META,在views.py里增加函数display_meta。 def display_meta(request): values = request.META.items() values.sort() html = [] for k, v in values: html.append('<tr><td>%s</td><td>%s</td>