Jumbo relies on some patches to the official django version that can be applied using the function jmb.core.monkey.patch() in settings/__init__.py:
# place these lines after any other code!!!
from jmb.core import monkey
monkey.patch()
Apply all patches Jumbo relyes on. Currently management commands, jquery, and timepicker
Parameters: | exclude – a list of strings naming the patches that will not be applied. ‘jquery’ patch will only be applied if cms is in INSTALLED_APPS |
---|
Django find_management_module fails at finding modules when namespaces are used.
This version of find_management_module tries a real import when django fails to find the module. The difference is that django only uses:
imp.find_module(...)
that doesn’t implement full module search algorithm. We’re going to place this code in settings/__init__.py, the older way to place it in :file:`urls.py doesn’t work as is not found when calling from command line as urls.py is not called:
from jmb.core import monkey
monkey.patch()
At the moment there’s an open ticket
MonkeyPatch django-cms not to overwrite jquery.
While django make attention to use djangojQuery and not to overwite standard $(), so different versions can coexist, PageAdmin and PluginEditor overwrite it with django.jQuery. Utilizzata in urls.py cosi:
from jmb.core import monkey
if settings.CMS_ENABLED:
urlpatterns += patterns('',
url(r'^', include('cms.urls')),
)
monkey.patch_cms_page_not_to_overwrite_jquery()
When running the development server, print in the console which errors have been raised when saveing an object. This in necessary when not all fields are used in a form and Django just says “Fix errors below”
This will work if you have a variable called RUNNING_DEVSERVER that can be initialized as follows:
import sys
try:
RUNNING_DEVSERVER = (sys.argv[1] == 'runserver')
except KeyError:
RUNNING_DEVSERVER = False
Datetime and time widgets in Django are pretty poor ones.
Html widgets used by admin are defined in django.contrib.admin.options in a dict named FORMFIELD_FOR_DBFIELD_DEFAULTS.
We overwrite it in jmb.core.admin.options and define a widget that is derived from jQuery.ui‘s default one.
A monkey patch vs autocomplete_light (rel 1.4.9) is applied from within our change_form.html so that Dynamic Autocompletion capabilities are added to standard autocomplete_light.
It’s called from extrahead block.