Clone wiki

django-lfs / GettingStartedDesign

  1. summary Getting Started: How to customise the LFS design#

Introduction

This document explains how you can have a custom CSS, the ability to customize templates and to point to new images.

Details

Create a new folder "mytheme" inside the buildout, with two subfolders: "templates" and "static". The path to the templates folder needs to be inserted in the "TEMPLATES_DIRS" variables from settings.py. To customize the base template, for example, create a "lfs/base.html" file inside the "templates" folder. Its content can be copied from the original in the lfs_theme folder. Add a new line in the header section, pointing to a new CSS file that will customize the base LFS stylesheet.

`<link rel=="stylesheet" type=="text/css" href=="MEDIA_URLmytheme/css/custom.css" />`

As a side note, this templates folder can be used for overriding any other template: templates in Django are usually denoted by a relative path, and you need only to replicate this path inside our overriding templates folder.

Next, overriding and creating new resources: create a "static" folder inside "mytheme" and link to it inside the lfs_project/media folder. Inside the "mytheme" folder you can now host images and files, in 2 new "css" and "img" subfolders. Back in the customized base.html change the logo path:

`<img class=="logo" src=="MEDIA_URLmytheme/img/logo.jpg" alt=="Logo" />`

That's about it: now you have got a custom CSS, the ability to customize templates and to point to new images.

Acknowledgement: information in the original version of this document taken from http://play.pixelblaster.ro/blog/archive/2009/09/17/customizing-django-lfs-lightning-fast-shop-for-the-non-django-developer Thanks tibi

Updated