Django Utiles for EPFL Sites

django_epfl的Python项目详细描述


本页将讨论django的epfl模板。这些模板有 是为了反映“web2010”Link graphical chart of EPFL而开发的。

要使用这些模板,请将django_epfl添加到INSTALLED_APPS。那么你 可以通过添加^{tt3}继承基模板$ 在模板中。

可用块列表

以下所有块都在epfl模板中。每个块显示在 它的上下文和旁边有它的角色描述。

  • <html>
    • <head>
      • additional_meta : Place here all the additional meta in the HTML form
      • additional_links : Same for the links to additional resources
      • additional_css : Here for the CSS (don’t place CSS under additional_links to improve clarity and template inheritance)
      • additional_js : All JS that need to be loaded in the head section
      • page_title : If using the ^{tt4}$ var is not the best option, you can use this block to set the page title
    • </head>
    • <body>
      • header : Here is the header include. By default, the header is in English. (file: ^{tt5}$) To see the other options, take a look the package doc<http://kis-doc.epfl.ch/django/template.html#change-header-language-search-option>.
      • <div id=”main content”>
        • breadcrumbs : It is where you will put the “EPFL > Project > Section” navigation style.
        • languages : Links in the top right corner that permit the user to switch between languages.
        • <h1>
          • title : Area for the title of the project and (in general) its acronym.
        • </h1>
        • main-navigation : Area that contains droplists and all the navigation for the project.
        • tools : Space for the tools like RSS feed button, share button and so on.
        • <div id=”content”>
          • content : Contains the main content for the page.
        • </div>
        • <div id=”right-col”>
          • right_column : Contains the secondary content in the right column. If empty, the template will automatically switch to 1-column mode and the “right-col” div will not be displayed.
        • </div>
        • footer : Area for general contents like contact link, copyright, …
      • </div>
      • additional_js_ajax : Place JS that don’t need to be loaded first.
    • </body>
  • </html>

可用变量列表

目前,只有titlevar(表示页面标题)是 可用。注意不要与大的title块混淆 页面上的黑色标题。

注意

如果设置了title var,则不会显示page_titleblock。

使用EPFL错误页

为了处理epfl 404错误页,必须修改文件 views.py然后放入这个:

from django.shortcuts import render_to_response

def error404(request):
    return render_to_response('django_epfl/errors/404.fr.html')

然后,在您的urls.py

from django.conf.urls.defaults import handler404

handler404 = 'django_site.views.error404'

要处理500个错误,这是相同的逻辑。因为错误像 503不是本机支持的,您必须在 代码。关于如何做到这一点的一些解释 here

https://docs.djangoproject.com/en/1.3/ref/request-response/#ref-httpresponse-subclasses 如果您需要返回一些具有已定义状态的httpresponse,也可以为您提供帮助 代码。

注意

如果DEBUG设置为,则不会显示404和500错误页 True

更改标题语言/搜索选项

可以使用header块更改头。

templates/template_incdir中有四个不同的头:
  • header.fr.html
  • header.en.html
  • header-no-local-search.fr.html
  • header-no-local-search.en.html

显然,在标题名中,fr表示法语和en英语。这个 no local search头的版本不包含搜索选项“on” 这个网站”。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javajexcel包装文本问题   EclipseJavaEnum缩进超过左括号。如何让它看起来更正常?   java有办法包含Tomcat 6 catalina。out和localhost。在网络应用的日志文件中记录内容?   java如何永久性地阻止JavaFX代码在eclipse中被突出显示为错误?   如何在java中优化两个for循环(for循环中的for循环)   java如何在我的windows机器上从jar文件创建mac osx的可执行文件   使用记忆化/动态规划的Java组合学   Java中的游荡对象垃圾收集   java为什么我在JSP和JDBC和MySQL中遇到连接失败错误   java轮询Pod的就绪状态   如何创建电子邮件并将其发送到Java中的特定地址?   java如何修复Dagger 2错误“。。。无法提供[…]”?   java Android单选按钮看起来太轻   Android Studio:开发在应用程序之间共享的通用java库