Skip to main content

Add template skins to django.

Project description

===========
DJANGO-SKIN
===========

Adds the ability to add "skins" to django projects by adding a custom template loader. This is useful if you have a
single code base with multiple deployments

*************
Documentation
*************

Add to ``INSTALLED APPS``
=========================
Add the module to your installed apps.

.. code-block:: python

INSTALLED_APS = (
...
'skin'
)

Use a skin
==========

There are two different ways you can use skins with django-skin. Using the new template loaders will add skins
globally to any Template views. Using the new `TemplateSkinView` will allow you to explicitly add a skin to a
specific views.

Template Loader
---------------
Add either of the template loaders to the top of your ``TEMPLATE_LOADERS`` in settings.py

.. code-block:: python

TEMPLATE_LOADERS = (
'skin.template.loaders.filesystem.Loader',
'skin.template.loaders.app_directories.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)

Custom View
-----------
You can also just use the `TemplateSkinView` to allow only specific views to be skinned.

.. code-block:: python

from skin.views import TemplateSkinView

class YourView(TemplateSkinView):
template_name = 'yourview.html'

def get(self, request, **kwargs):
# Your view code

You can also set two different attributes when using this view to overwrite the skin.

* *skin_name:* setting this will override what is in settings.SKIN_NAME
* *skin_path:* setting this will specify the exact path and will cause the view to ignore `skin_name` and any
created `SiteSkin`s.

Run migrations
==============
If you have south, run migrations

.. code-block:: bash

$ python manage.py migrate skin

Create skin in admin
====================
go to http://yoursite/admin/skin/add/ and add the skin.

Add skin folders
================
Add any folders under normal template directories (see `TEMPLATE_DIRS` in settings.py).

* templates/index.html
* templates/skin/index.html

If a view has a ``template_name`` of `'index.html'`, it will first look for it in the `templates/skin` folder, then
it will look in the `templates` folder (assuming you also have the default Django template loaders set up in
``TEMPLATE_LOADERS``.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

django-skin-0.1.zip (11.6 kB view details)

Uploaded Source

django-skin-0.1.1.zip (11.7 kB view details)

Uploaded Source

File details

Details for the file django-skin-0.1.zip.

File metadata

  • Download URL: django-skin-0.1.zip
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-skin-0.1.zip
Algorithm Hash digest
SHA256 c14e65f54f50a0690624843b8d6c7faba8b639048d4aa3e78e464773ece32b84
MD5 b4e9740c6685d0c63041278c9fdc2efb
BLAKE2b-256 19fc8a4345e49e843f58ed6336fc710c63233ad428afde39a3afc5a7290bb409

See more details on using hashes here.

File details

Details for the file django-skin-0.1.1.zip.

File metadata

  • Download URL: django-skin-0.1.1.zip
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-skin-0.1.1.zip
Algorithm Hash digest
SHA256 d0c32c3c620e99e65e7d1ab57b117621db7eb382628fe84d6c352c0d5ac1c2a6
MD5 cd99bc807be6b7fe83968b4f5d19561f
BLAKE2b-256 6840db6b69958aa2b231e70f5b924bf74111b477fba7fb9bdedc80a6171702fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page