From eaa17e13e849a18b0b0fb19468bd65a31b86b3b7 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Wed, 17 Feb 2010 18:54:02 +0000 Subject: [PATCH] Fixed #12705 -- Date/time and select filter widgets now work again with newly added inline forms in the admin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12454 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../contrib/admin/media/js/SelectFilter2.js | 4 +++ .../admin/media/js/admin/DateTimeShortcuts.js | 3 ++ django/contrib/admin/media/js/inlines.js | 1 - .../templates/admin/edit_inline/stacked.html | 32 +++++++++++++++--- .../templates/admin/edit_inline/tabular.html | 33 ++++++++++++++++--- django/contrib/admin/widgets.py | 3 ++ tests/regressiontests/admin_widgets/models.py | 8 ++++- 7 files changed, 74 insertions(+), 10 deletions(-) diff --git a/django/contrib/admin/media/js/SelectFilter2.js b/django/contrib/admin/media/js/SelectFilter2.js index db946a6f6f..5a0344702c 100644 --- a/django/contrib/admin/media/js/SelectFilter2.js +++ b/django/contrib/admin/media/js/SelectFilter2.js @@ -16,6 +16,10 @@ function findForm(node) { var SelectFilter = { init: function(field_id, field_name, is_stacked, admin_media_prefix) { + if (field_id.match(/__prefix__/)){ + // Don't intialize on empty forms. + return; + } var from_box = document.getElementById(field_id); from_box.id += '_from'; // change its ID from_box.className = 'filtered'; diff --git a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js index 016de90f28..fbaa599c7a 100644 --- a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js @@ -11,6 +11,7 @@ var DateTimeShortcuts = { calendarLinkName: 'calendarlink',// name of the link that is used to toggle clockDivName: 'clockbox', // name of clock
that gets toggled clockLinkName: 'clocklink', // name of the link that is used to toggle + shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts admin_media_prefix: '', init: function() { // Deduce admin_media_prefix by looking at the \ No newline at end of file + diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index 5c69bad24d..dc9552f454 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -1,4 +1,4 @@ -{% load i18n %} +{% load i18n adminmedia %}