Added support for queryset() overrides on admin classes and inline admin classes.
Updated version to 1.4.5. Updated README with explanation of requirements for overriding queryset() on inline models. Added extra models to sample project to demonstrate sortable models with custom querysets. Improved JavaScript of sortables to be more efficient with better comparison checking. Fixed highlighting of stacked inlines on sort finish.
This commit is contained in:
1 parent
b6e68fa367
commit
014f6d1660
16 files changed
+477
-68
No files matched your search
@@ -6,7 +6,7 @@ jQuery(function($){
|
||||
items : 'li',
|
||||
stop : function(event, ui)
|
||||
{
|
||||
var indexes = Array();
|
||||
var indexes = [];
|
||||
ui.item.parent().children('li').each(function(i)
|
||||
{
|
||||
indexes.push($(this).find(':hidden[name="pk"]').val());
|
||||
@@ -17,5 +17,7 @@ jQuery(function($){
|
||||
data: { indexes: indexes.join(',') }
|
||||
});
|
||||
}
|
||||
}).click(function(e){
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
@@ -10,21 +10,23 @@ jQuery(function($){
|
||||
items : '.inline-related',
|
||||
stop : function(event, ui)
|
||||
{
|
||||
var indexes = Array();
|
||||
var indexes = [];
|
||||
ui.item.parent().children('.inline-related').each(function(i)
|
||||
{
|
||||
index_value = $(this).find(':hidden[name$="-id"]').val();
|
||||
if (index_value != "" && index_value != undefined)
|
||||
var index_value = $(this).find(':hidden[name$="-id"]').val();
|
||||
if (index_value !== "" && index_value !== undefined)
|
||||
{
|
||||
indexes.push(index_value);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(),
|
||||
type: 'POST',
|
||||
data: { indexes : indexes.join(',') },
|
||||
success: function()
|
||||
{
|
||||
ui.item.effect('highlight', {}, 1000);
|
||||
ui.item.find('.form-row').effect('highlight', {}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,14 +10,16 @@ jQuery(function($){
|
||||
items : 'tr:not(.add-row)',
|
||||
stop : function(event, ui)
|
||||
{
|
||||
var indexes = Array();
|
||||
var indexes = [];
|
||||
ui.item.parent().children('tr').each(function(i)
|
||||
{
|
||||
index_value = $(this).find('.original :hidden:first').val();
|
||||
if (index_value != "" && index_value != undefined)
|
||||
var index_value = $(this).find('.original :hidden:first').val();
|
||||
if (index_value !== '' && index_value !== undefined)
|
||||
{
|
||||
indexes.push(index_value);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(),
|
||||
type: 'POST',
|
||||
|
||||
Reference in new issue
Block a user