Skip to content

Instantly share code, notes, and snippets.

View jezdez's full-sized avatar
🚴
💨

Jannis Leidel jezdez

🚴
💨
View GitHub Profile
diff --git a/cms/models/pluginmodel.py b/cms/models/pluginmodel.py
index fc318a9..108a165 100644
--- a/cms/models/pluginmodel.py
+++ b/cms/models/pluginmodel.py
@@ -5,7 +5,8 @@ from cms.plugin_rendering import PluginContext, PluginRenderer
from cms.exceptions import DontUsePageAttributeWarning
from publisher import MpttPublisher
from django.db import models
-from django.db.models.base import ModelBase
+from django.db.models.base import ModelBase, model_unpickle, simple_class_factory
diff --git a/cms/models/pluginmodel.py b/cms/models/pluginmodel.py
index fc318a9..108a165 100644
--- a/cms/models/pluginmodel.py
+++ b/cms/models/pluginmodel.py
@@ -5,7 +5,8 @@ from cms.plugin_rendering import PluginContext, PluginRenderer
from cms.exceptions import DontUsePageAttributeWarning
from publisher import MpttPublisher
from django.db import models
-from django.db.models.base import ModelBase
+from django.db.models.base import ModelBase, model_unpickle, simple_class_factory
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 2dabf3b..e9ab5c7 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -194,7 +194,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
- 'django.core.context_processors.media',
+ 'django.contrib.staticfiles.context_processors.staticfiles',
(django-dev)~/Code/git/django [git:master] $ time python tests/runtests.py --settings=django_testing.sqlite -v1 staticfiles_tests
Creating test database 'default'...
Creating test database 'other'...
Destroying old test database 'other'...
....................................
----------------------------------------------------------------------
Ran 36 tests in 1.198s
OK
Destroying test database 'default'...
diff --git a/django/contrib/staticfiles/management/commands/runserver.py b/django/contrib/staticfiles/management/commands/runserver.py
new file mode 100644
index 0000000..e138759
--- /dev/null
+++ b/django/contrib/staticfiles/management/commands/runserver.py
@@ -0,0 +1,27 @@
+from optparse import make_option
+
+from django.conf import settings
+from django.core.management.commands.runserver import BaseRunserverCommand
@jezdez
jezdez / custom_settings.py
Created December 28, 2010 12:08
support for legacy locations of app media (in APP/media/)
# Add this to your settings.py
STATICFILES_FINDERS += (
'mysite.finders.AppMediaFinder'
)
@jezdez
jezdez / gist:854559
Created March 4, 2011 12:38
Translation stats of Django 1.2.X, compare with http://www.transifex.net/projects/p/django/r/one-dot-three/
ar: translated: 65%, fuzzy: 0%, untranslated: 34%
bg: translated: 43%, fuzzy: 15%, untranslated: 40%
bn: translated: 38%, fuzzy: 8%, untranslated: 52%
bs: translated: 54%, fuzzy: 0%, untranslated: 44%
ca: translated: 84%, fuzzy: 7%, untranslated: 8%
cs: translated: 100%, fuzzy: 0%, untranslated: 0%
cy: translated: 18%, fuzzy: 22%, untranslated: 58%
da: translated: 98%, fuzzy: 0%, untranslated: 0%
de: translated: 100%, fuzzy: 0%, untranslated: 0%
el: translated: 27%, fuzzy: 26%, untranslated: 46%

How django_compressor {% compress %} works behind the scenes

This document assumes you already have an up and running instance of django_compressor, and that you understand how to use it in your templates. The goal is to explain what the main template tag, {% compress %}, does behind the scenes, to help you debug performance problems for instance.

First step: Offline cache

from django.contrib.staticfiles.storage import AppStaticStorage
from django.contrib.staticfiles.finders import AppDirectoriesFinder
class LegacyAppMediaStorage(AppStaticStorage):
source_dir = 'media'
class LegacyAppDirectoriesFinder(AppDirectoriesFinder):
storage_class = LegacyAppMediaStorage
@jezdez
jezdez / ps1.bash
Created May 30, 2011 12:18 — forked from zain/ps1.bash
PS1 that looks smexy (with added hg support)
#### PS1 customization ####
NONE="\[\033[0m\]" # unsets color to term fg color
# regular colors
K="\[\033[0;30m\]" # black
R="\[\033[0;31m\]" # red
G="\[\033[0;32m\]" # green
Y="\[\033[0;33m\]" # yellow
B="\[\033[0;34m\]" # blue
M="\[\033[0;35m\]" # magenta