how to made a "admin-only" for in html page (not view.py),has this method :user.is_superuser ??

Posted by zjm1126 on Stack Overflow See other posts from Stack Overflow or by zjm1126
Published on 2010-04-19T01:10:09Z Indexed on 2010/04/19 1:13 UTC
Read the original article Hit count: 177

Filed under:

in views.py:

@user_passes_test(lambda u: u.is_superuser)
def h_view(request):
    return render_to_response('mytest/news.html',context_instance=RequestContext(request))

but i want to show this page when admin login,and my now page is :

<li id="tab_mytest"><a href="{% url mytest_list %}" class="{% block mytest_css_name %}{% endblock %}">{% trans "mytest" %}</a></li>

how to change it,

has this method :user.is_superuser ??

thanks

© Stack Overflow or respective owner

Related posts about django