Permalink
Browse files

Added a blank template and updated logic so that if you don't set you…

…r CMS_TEMPLATES setting it will use the blank one shipped with django-cms-themes. Also updated the PROJECT_DIR setting to be PROJECT_PATH, since that's what the Django CMS Quickstart Guide suggests
  • Loading branch information...
1 parent 87bad0e commit df96d6bd8d134966748fae630a0f3869ba9509e8 @MegaMark16 committed Jul 18, 2013
Showing with 27 additions and 11 deletions.
  1. +11 −7 README.rst
  2. +4 −3 cms_themes/__init__.py
  3. +0 −1 cms_themes/admin.py
  4. +12 −0 cms_themes/templates/blank.html
View
18 README.rst
@@ -1,6 +1,7 @@
django-cms-themes
=================
-A django app that lets you load theme packs that are bundled templates, and select which theme a site should use.
+A django app that lets you load theme packs that are bundled templates, and
+select which theme a site should use.
Dependencies
============
@@ -15,7 +16,8 @@ To get started simply install using ``pip``:
::
pip install django-cms-themes
-Add ``'cms_themes',`` to your installed apps and ``syncdb`` (or migrate, if you have south installed).
+Add ``'cms_themes',`` to your installed apps and ``syncdb`` (or migrate, if
+you have south installed).
Your installed apps should look something like this:
::
@@ -29,15 +31,17 @@ Your installed apps should look something like this:
'cms',
'cms_themes',
)
-
-You should have a setting in your settings file called PROJECT_DIR that points to the root of your project, i.e. ``PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))``
+
+Per the django-cms quickstart guide, you should have a setting in your
+settings file called PROJECT_PATH that points to the root of your project, i.e.
+``PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))``
If not, it will be assumed that your themes will live just beneath the ``MEDIA_ROOT``.
Usage
=============
All usage is done through the admin.
-Simply create a new Theme record and upload a theme tarball (tar.gz) file from http://www.djangocmsthemes.com. All templates from themes uploaded should now show up in your Templates drop down on a django cms page.
-
-
+Simply create a new Theme record and upload a theme tarball (tar.gz) file from
+http://www.djangocmsthemes.com. All templates from themes uploaded should now
+show up in your Templates drop down on a django cms page.
View
7 cms_themes/__init__.py
@@ -5,8 +5,8 @@
def init_themes():
if not hasattr(settings, 'THEMES_DIR'):
- if hasattr(settings, 'PROJECT_DIR'):
- THEMES_DIR = os.path.join(settings.PROJECT_DIR, 'themes')
+ if hasattr(settings, 'PROJECT_PATH'):
+ THEMES_DIR = os.path.join(settings.PROJECT_PATH, 'themes')
elif hasattr(settings, 'PROJECT_HOME'):
THEMES_DIR = os.path.join(settings.PROJECT_HOME, 'themes')
else:
@@ -17,6 +17,8 @@ def init_themes():
('themes', THEMES_DIR),
) + settings.STATICFILES_DIRS
setattr(settings, 'THEMES_DIR', THEMES_DIR)
+ if not hasattr(settings, 'CMS_TEMPLATES'):
+ setattr(settings, 'CMS_TEMPLATES', (('blank.html', 'Blank'),))
if not hasattr(settings, 'DEFAULT_CMS_TEMPLATES'):
setattr(settings, 'DEFAULT_CMS_TEMPLATES', settings.CMS_TEMPLATES)
if settings.THEMES_DIR not in settings.TEMPLATE_DIRS:
@@ -59,7 +61,6 @@ def set_themes():
try:
from django.conf import settings
from django.contrib.sites.models import Site
- from cms.conf.patch import post_patch
from cms_themes.models import Theme
init_themes()
View
1 cms_themes/admin.py
@@ -21,4 +21,3 @@ class ThemeAdmin(admin.ModelAdmin):
t.choices.extend(template_choices)
admin.site.register(Page, PageAdmin)
-
View
12 cms_themes/templates/blank.html
@@ -0,0 +1,12 @@
+{% load cms_tags sekizai_tags %}
+<html>
+ <head>
+ {% render_block "css" %}
+ </head>
+ <body>
+ {% cms_toolbar %}
+ {% placeholder base_content %}
+ {% block base_content%}{% endblock %}
+ {% render_block "js" %}
+ </body>
+</html>

0 comments on commit df96d6b

Please sign in to comment.