mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 21:37:49 -05:00
maintain env config when admin sorting tree
This commit is contained in:
@@ -91,10 +91,11 @@ admin.site.register(SyncLog, SyncLogAdmin)
|
|||||||
|
|
||||||
@admin.action(description='Fix problems and sort tree by name')
|
@admin.action(description='Fix problems and sort tree by name')
|
||||||
def sort_tree(modeladmin, request, queryset):
|
def sort_tree(modeladmin, request, queryset):
|
||||||
|
orginal_value = modeladmin.model.node_order_by[:]
|
||||||
modeladmin.model.node_order_by = ['name']
|
modeladmin.model.node_order_by = ['name']
|
||||||
with scopes_disabled():
|
with scopes_disabled():
|
||||||
Keyword.fix_tree(fix_paths=True)
|
Keyword.fix_tree(fix_paths=True)
|
||||||
modeladmin.model.node_order_by = []
|
modeladmin.model.node_order_by = orginal_value
|
||||||
|
|
||||||
|
|
||||||
class KeywordAdmin(TreeAdmin):
|
class KeywordAdmin(TreeAdmin):
|
||||||
|
|||||||
Reference in New Issue
Block a user