mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-04-28 18:54:50 +00:00
Added README and LICENSE
git-svn-id: https://django-dbtemplates.googlecode.com/svn/trunk@3 cfb8ba98-e953-0410-9cff-959ffddf5974 committer: leidel <leidel@cfb8ba98-e953-0410-9cff-959ffddf5974> --HG-- extra : convert_revision : d5bdf5609554abd12d96287737d08c08ddbb8df2
This commit is contained in:
parent
f4e0431359
commit
bf5127ccc5
3 changed files with 84 additions and 1 deletions
28
template/LICENSE
Normal file
28
template/LICENSE
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Copyright (c) 2007, Jannis Leidel
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of the author nor the names of other
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
55
template/README
Normal file
55
template/README
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
Database template loader for Django
|
||||
===================================
|
||||
|
||||
This is a basic database template loader for Django which uses a m2m
|
||||
relationship to provide a site centric template loading.
|
||||
|
||||
How to use it in your own django application
|
||||
============================================
|
||||
|
||||
0. Get the source from the subversion repository
|
||||
1. Copy the "template" directory to your django project directory
|
||||
2. Edit your settings.py:
|
||||
|
||||
# Add ``myapp.template`` to the ``INSTALLED_APPS`` where "myapp" is the
|
||||
name of your django project
|
||||
|
||||
# Check if ``django.contrib.sites`` and ``django.contrib.admin`` are in
|
||||
``INSTALLED_APPS`` and add if necessary
|
||||
|
||||
It should look something like this:
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.flatpages',
|
||||
'myapp.blog',
|
||||
'myapp.template',
|
||||
)
|
||||
|
||||
# Add ``myapp.template.loaders.database.load_template_source```to the
|
||||
``TEMPLATE_LOADERS`` where "myapp" is the name of your django project
|
||||
|
||||
It should look something like this:
|
||||
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.load_template_source',
|
||||
'django.template.loaders.app_directories.load_template_source',
|
||||
'websushi.template.loaders.database.load_template_source',
|
||||
)
|
||||
|
||||
3. Sync your database via shell (hint: "./manage.py syncdb" within project dir)
|
||||
4. Restart your Django server
|
||||
5. Go to the admin interface and add templates by filling the ``name`` field
|
||||
with filename like identifiers, for example "blog/entry_list.html"
|
||||
6. Use it with ``Flatpages``, ``Generic views`` and your own custom views
|
||||
|
||||
What? Hm, doesn't work here. || Aaah nice, BUT...
|
||||
=================================================
|
||||
|
||||
Please leave your questions and messages on the designated Google Code site:
|
||||
|
||||
http://code.google.com/p/django-databasetemplateloader/
|
||||
|
|
@ -10,7 +10,7 @@ except:
|
|||
|
||||
def load_template_source(template_name, template_dirs=None):
|
||||
"""
|
||||
Loader which gets the template content from the database depending on
|
||||
Loader which fetches the template content from the database depending on
|
||||
the current ``Site``.
|
||||
"""
|
||||
if site is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue