|
1 | | -import os |
2 | 1 | import json |
| 2 | +from pathlib import Path |
3 | 3 | from itertools import chain |
4 | 4 | from types import MethodType |
5 | 5 |
|
| 6 | +from django.conf import settings |
6 | 7 | from django.contrib import admin, messages |
7 | 8 | from django.contrib.contenttypes.forms import BaseGenericInlineFormSet |
8 | 9 | from django.contrib.contenttypes.models import ContentType |
@@ -62,7 +63,7 @@ class SortableAdminBase: |
62 | 63 | @property |
63 | 64 | def media(self): |
64 | 65 | css = {'all': ['adminsortable2/css/sortable.css']} |
65 | | - js = ['adminsortable2/js/adminsortable2.min.js'] |
| 66 | + js = ['adminsortable2/js/adminsortable2{}.js'.format('' if settings.DEBUG else '.min')] |
66 | 67 | return super().media + widgets.Media(css=css, js=js) |
67 | 68 |
|
68 | 69 | def get_formset_kwargs(self, request, obj, inline, prefix): |
@@ -95,9 +96,9 @@ def change_list_template(self): |
95 | 96 | opts = self.model._meta |
96 | 97 | app_label = opts.app_label |
97 | 98 | return [ |
98 | | - os.path.join('adminsortable2', app_label, opts.model_name, 'change_list.html'), |
99 | | - os.path.join('adminsortable2', app_label, 'change_list.html'), |
100 | | - 'adminsortable2/change_list.html' |
| 99 | + Path('adminsortable2') / Path(app_label) / Path(opts.model_name) / Path('change_list.html'), |
| 100 | + Path('adminsortable2') / Path(app_label) / Path('change_list.html'), |
| 101 | + Path('adminsortable2/change_list.html'), |
101 | 102 | ] |
102 | 103 |
|
103 | 104 | def __init__(self, model, admin_site): |
|
0 commit comments