Fixed jQuery namespace on inline model JavaScript includes.

Version bump to 1.6.5.
Updated readme.
master
Brandon Taylor 2014-02-12 16:22:04 -05:00
parent d5d6f54135
commit 53df734e15
6 changed files with 16 additions and 22 deletions

View File

@ -1,6 +1,6 @@
# Django Admin Sortable
Current version: 1.6.4
Current version: 1.6.5
This project makes it easy to add drag-and-drop ordering to any model in
Django admin. Inlines for a sortable model may also be made sortable,
@ -308,8 +308,8 @@ ordering on top of that just seemed a little much in my opinion.
django-admin-sortable is currently used in production.
### What's new in 1.6.4?
- Added "sorting_filters" to specify a subset of model objects to be sorted.
### What's new in 1.6.5?
- Namespace fixes for jQuery in Django admin
### Future

View File

@ -1,4 +1,4 @@
VERSION = (1, 6, 4) # following PEP 386
VERSION = (1, 6, 5) # following PEP 386
DEV_N = None

View File

@ -6,7 +6,7 @@
var sortable_inline_rows = $('.inline-group .inline-related');
sortable_inline_rows.addClass('sortable');
jQuery('.inline-group').sortable({
$('.inline-group').sortable({
axis : 'y',
containment : 'parent',
create: function(event, ui) {
@ -26,8 +26,7 @@
ui.item.parent().children('.inline-related').each(function(i)
{
var index_value = $(this).find(':hidden[name$="-id"]').val();
if (index_value !== "" && index_value !== undefined)
{
if (index_value !== "" && index_value !== undefined) {
indexes.push(index_value);
}
});
@ -36,8 +35,7 @@
url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(),
type: 'POST',
data: { indexes : indexes.join(',') },
success: function()
{
success: function() {
ui.item.find('.form-row').effect('highlight', {}, 1000);
}
});

View File

@ -5,17 +5,15 @@
{
var tabular_inline_rows = $('.tabular table tbody tr');
tabular_inline_rows.addClass('sortable');
jQuery('.tabular.inline-related').sortable({
$('.tabular.inline-related').sortable({
axis : 'y',
containment : 'parent',
create: function(event, ui)
{
create: function(event, ui) {
$('td.delete :checkbox').unbind();
},
tolerance : 'pointer',
items : 'tr:not(.add-row)',
stop : function(event, ui)
{
stop : function(event, ui) {
if ($('.inline-deletelink').length > 0) {
$(ui.sender).sortable('cancel');
alert($('#localized_save_before_reorder_message').val());
@ -26,8 +24,7 @@
ui.item.parent().children('tr').each(function(i)
{
var index_value = $(this).find('.original :hidden:first').val();
if (index_value !== '' && index_value !== undefined)
{
if (index_value !== '' && index_value !== undefined) {
indexes.push(index_value);
}
});
@ -36,8 +33,7 @@
url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(),
type: 'POST',
data: { indexes : indexes.join(',') },
success: function()
{
success: function() {
//highlight sorted row, then re-stripe table
ui.item.effect('highlight', {}, 1000);
tabular_inline_rows.removeClass('row1 row2');

View File

@ -12,8 +12,8 @@ setup(
long_description=README,
license='APL',
author='Brandon Taylor',
author_email='brandon@iambrandontaylor.com',
url='http://iambrandontaylor.com/',
author_email='alsoicode@gmail.com',
url='https://brandonftaylor.com/',
packages=find_packages(exclude=['sample_project']),
zip_safe=False,
include_package_data=True,