Skip to main content

Django utils for EPFL sites

Project description

django-epfl
***********

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 <http://atelierweb.epfl.ch/charte-graphique>`_.

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.

.. note::
If title var is set, ``page_title`` block won't be displayed.

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 <http://mitchfournier.com/2010/07/12/show-a-custom-403-forbidden-error-page-in-django/>`_.

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.

.. note::
The 404 and 500 error pages won't be displayed if ``DEBUG`` is set to
``True``.

.. _change_language:

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.

Files for django_epfl, version 1.5.3
Filename, size File type Python version Upload date Hashes
Filename, size django_epfl-1.5.3.tar.gz (217.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page