django_项目管理(1)

1、获取所有的项目:[views.py]

@login_required
def project_manage(request):
    project_all = Project.objects.all()
    return render(request, "project.html",{"projects":project_all})

2、遍历显示查出的项目名称:[project.html]

{% for project in projects %}
     {{ project.name }}
{% endfor %}

3、日期时间显示:

{{ project.create_time | date:"Y-m-d H:i:s" }}

你可能感兴趣的:(django_项目管理(1))