Django utils for EPFL sites
Project description
This page will talk about the EPFL templates for django. These templates have been developed in order to reflect the “web2010” Link graphical chart of EPFL.
To use these templates, add django_epfl to your INSTALLED_APPS. Then you can inherit the base template by adding {% extends 'django_epfl/base.html' %} in a template.
List of available blocks
All the following blocks are in the EPFL template. Each block is displayed in its context and has its role description next to it.
<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 title 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: django_epfl/template_inc/header.en.html) 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>
List of available variables
For the moment, only the title var (representing the page title) is available. Care to not be confused with the title block which is the big black title on the page.
Use the EPFL error pages
In order to handle EPFL 404 error page, you have to modify your file views.py and put in it this:
from django.shortcuts import render_to_response def error404(request): return render_to_response('django_epfl/errors/404.fr.html')
Then, in your urls.py:
from django.conf.urls.defaults import handler404 handler404 = 'django_site.views.error404'
To handle the 500 error, it is the same logic. Since errors like 503 are not natively supported, you will have to create and raise it in your code. Some explanations on how to do this here.
https://docs.djangoproject.com/en/1.3/ref/request-response/#ref-httpresponse-subclasses can help you too if you need to return some HttpResponse with a defined status code.
Change header language / search option
You can change the header with the header block.
- There are four different headers available in the templates/template_inc dir:
header.fr.html
header.en.html
header-no-local-search.fr.html
header-no-local-search.en.html
Obviously, in the header name, fr means French and en English. The no-local-search version of the header does not include the search option “On this site”.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django_epfl-1.5.6.tar.gz
.
File metadata
- Download URL: django_epfl-1.5.6.tar.gz
- Upload date:
- Size: 52.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6574b2683695ffe8a1ff3759821919a931a9c0006d695d7f8ed253bf99ece70 |
|
MD5 | db3690692748952ea6cdd77e6818af59 |
|
BLAKE2b-256 | c3039ff212d241d054e3dd4d3ca4eff524956286d17f901c35881beabafce389 |