Skip to content

Commit

Permalink
Switch to newer Mezzanine and rename site_media to static for now, un…
Browse files Browse the repository at this point in the history
…til we can handle static dirs with different naming.
  • Loading branch information
natea committed Jan 11, 2011
1 parent 1e6e24b commit ffa17cc
Show file tree
Hide file tree
Showing 50 changed files with 773 additions and 208 deletions.
10 changes: 10 additions & 0 deletions local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@

DATABASES = {
"default": {
# "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle".
"ENGINE": "sqlite3",
# DB name or path to database file if using sqlite3.
"NAME": "mezzanine.db",
# Not used with sqlite3.
"USER": "",
# Not used with sqlite3.
"PASSWORD": "",
# Set to empty string for localhost. Not used with sqlite3.
"HOST": "",
# Set to empty string for default. Not used with sqlite3.
"PORT": "",
}
}
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
dev_path = os.path.abspath(os.path.join(project_path, "..", ".."))
if dev_path not in sys.path:
sys.path.insert(0, dev_path)
import mezzanine
mezzanine_path = os.path.dirname(os.path.abspath(mezzanine.__file__))
from mezzanine.utils.path import path_for_import
mezzanine_path = path_for_import("mezzanine")
assert os.path.abspath(os.path.join(mezzanine_path, "..")) == dev_path

from django.core.management import execute_manager
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Mezzanine==0.10
PIL
PIL==1.1.7
django-grappelli==2.3
django-filebrowser==3.1
73 changes: 27 additions & 46 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

# Mezzanine settings.
THEME = ""

# Main Django settings.
TIME_ZONE = ""
DEBUG = False
DEV_SERVER = False
MANAGERS = ADMINS = ()
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
LANGUAGE_CODE = "en"
SITE_ID = 1
USE_I18N = False
SECRET_KEY = "aa75ab1e-4926-4628-911d-15de6a0d42f752b0e1ca-38f6-469f-a4d3-00d24d9ae62b6634bd71-2d83-4846-96a4-b40210c519c3"
SECRET_KEY = "84c29cdf-b5c3-4b18-b086-afa6e67bcaf84cdf4d27-2adb-4e24-9877-b81575ebb3362dc609c6-8d74-4a0a-88fc-5ef0b3d6cbe9"
INTERNAL_IPS = ("127.0.0.1",)
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
Expand All @@ -16,12 +21,18 @@
# Databases.
DATABASES = {
"default": {
# "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle".
"ENGINE": "",
"HOST": "",
# DB name or path to database file if using sqlite3.
"NAME": "",
# Not used with sqlite3.
"USER": "",
# Not used with sqlite3.
"PASSWORD": "",
# Set to empty string for localhost. Not used with sqlite3.
"HOST": "",
# Set to empty string for default. Not used with sqlite3.
"PORT": "",
"USER": "",
}
}

Expand All @@ -31,9 +42,9 @@
_project_dir = _project_path.split(os.sep)[-1]
ADMIN_MEDIA_PREFIX = "/media/"
CACHE_MIDDLEWARE_KEY_PREFIX = _project_dir
MEDIA_URL = "/site_media/"
MEDIA_URL = "/static/"
MEDIA_ROOT = os.path.join(_project_path, MEDIA_URL.strip("/"))
ROOT_URLCONF = "urls"
ROOT_URLCONF = "%s.urls" % _project_dir
TEMPLATE_DIRS = (os.path.join(_project_path, "templates"),)

# Apps.
Expand Down Expand Up @@ -65,20 +76,19 @@
"django.contrib.sessions.middleware.SessionMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.redirects.middleware.RedirectFallbackMiddleware",
"django.middleware.cache.UpdateCacheMiddleware",
"mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
"mezzanine.core.middleware.MobileTemplate",
"mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware",
"mezzanine.core.middleware.AdminLoginInterfaceSelector",
)

# Store these package names here as they may change in the future since
# Store these package names here as they may change in the future since
# at the moment we are using custom forks of them.
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"

# Optional apps.
# Optional apps - these will be added to ``INSTALLED_APPS`` if available.
OPTIONAL_APPS = (
"debug_toolbar",
"south",
Expand All @@ -87,8 +97,11 @@
PACKAGE_NAME_GRAPPELLI,
)

DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": False}

import sys
if not (len(sys.argv) > 1 and sys.argv[1] == "test"):
TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"
if not TESTING:
for app in OPTIONAL_APPS:
try:
__import__(app)
Expand All @@ -98,44 +111,12 @@
INSTALLED_APPS += (app,)
INSTALLED_APPS = sorted(list(INSTALLED_APPS), reverse=True)

# Optional app settings.
_package_path = lambda p: os.path.dirname(__import__(p).__file__)
if "debug_toolbar" in INSTALLED_APPS:
DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": False}
MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
if PACKAGE_NAME_GRAPPELLI in INSTALLED_APPS:
GRAPPELLI_ADMIN_HEADLINE = "Mezzanine"
GRAPPELLI_ADMIN_TITLE = "Mezzanine"
GRAPPELLI_MEDIA_PATH = os.path.join(
_package_path(PACKAGE_NAME_GRAPPELLI), "media")
if PACKAGE_NAME_FILEBROWSER in INSTALLED_APPS:
FILEBROWSER_URL_FILEBROWSER_MEDIA = "/site_media/uploads"
FILEBROWSER_PATH_FILEBROWSER_MEDIA = os.path.join(
_package_path(PACKAGE_NAME_FILEBROWSER), "site_media", "uploads")

# Caching.
CACHE_BACKEND = ""
CACHE_TIMEOUT = CACHE_MIDDLEWARE_SECONDS = 0
try:
import cmemcache
except ImportError:
try:
import memcache
except ImportError:
CACHE_BACKEND = "locmem:///"
if not CACHE_BACKEND:
CACHE_TIMEOUT = CACHE_MIDDLEWARE_SECONDS = 180
CACHE_BACKEND = "memcached://127.0.0.1:11211/?timeout=%s" % \
CACHE_MIDDLEWARE_SECONDS
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

# Local settings.
try:
from local_settings import *
except ImportError:
pass

# Dynamic settings.
# This doesn't seem to be used anymore, so commenting it out.
#from mezzanine.utils import set_dynamic_settings
#set_dynamic_settings(globals())
from mezzanine.utils.conf import set_dynamic_settings
set_dynamic_settings(globals())
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added static/uploads/mezzanine2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/uploads/mezzanine2_fb_thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

{% if request.user.is_authenticated and not is_popup and not request.GET.pop %}
<style type="text/css">

.add-row {display:none;}
.breadcrumbs {display:none; height:30px; margin:0; padding:0;
background:#e6e6e6 !important;}
Expand All @@ -60,14 +61,28 @@
border-bottom:1px solid #ccc; padding:0;}
#bookmarks {display:none;}
.messagelist {margin-top:14px; z-index:0 !important;}

{% if original.overridden %}
.slug, .deletelink {display:none !important;}
{% endif %}
{% if singleton %}
.submit-row * {display:none !important;}
.submit-row .default {display:inline !important;}
{% endif %}

/* make save/delete buttons always available at bottom of screen. */
.change-form div.submit-row {
position: fixed; left: 0; bottom: 0; right: 0;
margin: 0; padding: 10px 15px;
background: #e6e6e6; border-top: 1px solid #ccc;
text-align: right;
}

/* Fix for IE7 layout issue */
#content { margin-left: 0; margin-right: 0; padding: 0 15px; }

</style>

<script type="text/javascript">
// Global flag used for checking whether to hide the visible menu after a small
// timeout has passed when mousing out from a menu.
Expand Down Expand Up @@ -129,6 +144,7 @@

// Provides link back to homepage.
$('#user-tools li:last').before('<li><a href="/">View Site</a></li>');

});

// Remove extraneous ``template`` forms from inline formsets since we have
Expand Down Expand Up @@ -158,12 +174,12 @@

<label class="required">{% trans "Interface:" %}</label>

<input class="interface" type="radio" name="interface" id="interface_admin"
value="admin"{% ifnotequal request.REQUEST.interface "site" %} checked{% endifnotequal %} />
<input class="interface" type="radio" name="mezzanine_login_interface" id="interface_admin"
value="admin"{% ifnotequal request.REQUEST.mezzanine_login_interface "site" %} checked{% endifnotequal %} />
<label class="interface" for="interface_admin">{% trans "Admin" %}</label>

<input class="interface" type="radio" name="interface" id="interface_site"
value="site"{% ifequal request.REQUEST.interface "site" %} checked{% endifequal %} />
<input class="interface" type="radio" name="mezzanine_login_interface" id="interface_site"
value="site"{% ifequal request.REQUEST.mezzanine_login_interface "site" %} checked{% endifequal %} />
<label class="interface" for="interface_site">{% trans "Site" %}</label>

</div>
Expand Down
6 changes: 6 additions & 0 deletions templates/admin/forms/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

{% load i18n %}

{% block extrahead %}{{ block.super }}
<style type="text/css">
.dynamic-inline .vTextField {width:100px !important;}
</style>
{% endblock %}

{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">
Expand Down
7 changes: 7 additions & 0 deletions templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
.module ul {list-style-type:none !important; margin-left:0px;}
.mini {font-size:.9em;}
</style>

<!--[if IE 7]>
<style>
.dashboard #content { padding-top: 80px; }
</style>
<![endif]-->

{% endblock %}
{% block javascripts %}
{{ block.super }}
Expand Down
40 changes: 29 additions & 11 deletions templates/admin/pages/page/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@

h1 {width:300px;}
#tree {margin-top:10px; width:600px;}
#tree div {border:1px solid #ccc; background:#f9f9f9; padding:7px;
float:left; width:100%; margin:2px; height:18px;}
#tree ul {padding:0;}
#tree div {border:1px solid #ddd; background:#f9f9f9; padding:7px;
border-top-color:#eee; border-bottom-color:#ccc;
float:left; width:100%; margin:3px; height:18px;
background: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#e6e6e6));
background: -moz-linear-gradient(top, #f9f9f9, #e6e6e6);}
#tree ul {padding:0; margin:0px !important;}
#tree ul ul {padding-left:40px; display:none;}
#tree li {list-style-type:none;}
#tree .tree-toggle, #tree .changelink {float:left; font-weight:bold;
font-size:12px;}
#tree .tree-toggle {visibility:hidden;}
#tree a {float:right;}
#tree a .icon {display:block; float:left; width:16px; color:#fff;
text-align:center; background:#c6c6c6; margin:0 8px 0 4px;}
text-align:center; background:#c6c6c6; margin:0 8px 0 4px;
border-radius:2px;}
#tree a .close {display:none;}
#tree a:hover .icon {color:#fff; background:#5B80B2;}
.ordering {float:right; cursor:move; margin-left:10px;}

.addlist {float:right; margin-top:-3px;}
#addlist-primary {float:left; width:620px; text-align:right;
margin-top:-25px;}

.placeholder {border:1px dashed #ddd;}

</style>

Expand Down Expand Up @@ -101,19 +107,31 @@
// AJAX callback that's triggered when dragging a page to re-order
// it has ended.
var updateOrdering = function(event, ui) {
var ordering = $(this).sortable('toArray').toString();
$.post('{% url admin_page_ordering %}', {ordering: ordering},
function(data){
var args = {
'ordering_from': $(this).sortable('toArray').toString(),
'ordering_to': $(ui.item).parent().sortable('toArray').toString(),
};
if (args['ordering_from'] != args['ordering_to']) {
// Branch changed - set the new parent ID.
args['moved_page'] = $(ui.item).attr('id');
args['moved_parent'] = $(ui.item).parent().parent().attr('id');
if (args['moved_parent'] == 'tree') {
delete args['moved_parent'];
}
} else {
delete args['ordering_to'];
}
$.post('{% url admin_page_ordering %}', args, function(data) {
if (data !== "ok") {
alert("Error occured: " + data + "\nOrdering wasn't updated.");
}
});
};


// Make the pages sortable via drag and drop.
$('#tree ul').sortable({handle: '.ordering', axis: 'y', opacity: '.7',
stop: updateOrdering});
$('#tree ul').sortable({handle: '.ordering', connectWith: '#tree ul',
opacity: '.7', stop: updateOrdering, forcePlaceholderSize: true,
placeholder: 'placeholder', revert: 150, toleranceElement: ' div'});
$('#tree ul').disableSelection();

});
Expand All @@ -139,7 +157,7 @@
{% ifequal cl.result_count 0 %}
<p class="paginator">0 {{ cl.opts.verbose_name_plural }}</p>
{% else %}
<div id="tree">{% tree_menu_admin %}</div>
<div id="tree">{% page_menu "pages/menus/admin.html" %}</div>
{% endifequal %}

</div>
Expand Down
Loading

0 comments on commit ffa17cc

Please sign in to comment.