Django18初体验


1214 浏览 5 years, 3 months

35 CONTENT FOR AUTHENTICATED USERS

版权声明: 转载请注明出处 http://www.codingsoho.com/

添加about.html

home.html

{% block jumbotron %}
  {# % if not request.user.is_authenticated % #}
    <div class="jumbotron">
    </div>
  {# % endif % #}
{% endblock %}

{% block content %}
{% if request.user.is_authenticated %}
<h1>You are logged in!</h1>
    {% queryset %}
{% else %}
{% endif %} 
view.py
    if request.user.is_authenticated() and request.user.is_staff:
        context = {
            "queryset" : [123,456]
        }