Fix inline admin templates to display FontAwesome icons and be Django 2 & 3 compatible.
Version bump to 2.2.3. Updated READMEs.master
parent
bee77a28db
commit
db162bf890
|
|
@ -609,8 +609,8 @@ ordering on top of that just seemed a little much in my opinion.
|
||||||
### Status
|
### Status
|
||||||
django-admin-sortable is currently used in production.
|
django-admin-sortable is currently used in production.
|
||||||
|
|
||||||
### What's new in 2.2.2?
|
### What's new in 2.2.3?
|
||||||
- Fixed FontAwesome icons not showing up in inline sortable templates.
|
- Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3.
|
||||||
|
|
||||||
### Future
|
### Future
|
||||||
- Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super.
|
- Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super.
|
||||||
|
|
|
||||||
|
|
@ -751,10 +751,10 @@ Status
|
||||||
|
|
||||||
django-admin-sortable is currently used in production.
|
django-admin-sortable is currently used in production.
|
||||||
|
|
||||||
What’s new in 2.2.2?
|
What’s new in 2.2.3?
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- Fixed FontAwesome icons not showing up in inline sortable templates.
|
- Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3.
|
||||||
|
|
||||||
Future
|
Future
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
VERSION = (2, 2, 2)
|
VERSION = (2, 2, 3)
|
||||||
DEV_N = None
|
DEV_N = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ class SortableInlineBase(SortableAdminBase, InlineModelAdmin):
|
||||||
|
|
||||||
class SortableTabularInline(TabularInline, SortableInlineBase):
|
class SortableTabularInline(TabularInline, SortableInlineBase):
|
||||||
"""Custom template that enables sorting for tabular inlines"""
|
"""Custom template that enables sorting for tabular inlines"""
|
||||||
if VERSION < (2, 0):
|
if VERSION >= (2, 0):
|
||||||
template = 'adminsortable/edit_inline/tabular-1.10.x.html'
|
template = 'adminsortable/edit_inline/tabular-1.10.x.html'
|
||||||
else:
|
else:
|
||||||
template = 'adminsortable/edit_inline/tabular.html'
|
template = 'adminsortable/edit_inline/tabular.html'
|
||||||
|
|
@ -366,7 +366,7 @@ class SortableTabularInline(TabularInline, SortableInlineBase):
|
||||||
|
|
||||||
class SortableStackedInline(StackedInline, SortableInlineBase):
|
class SortableStackedInline(StackedInline, SortableInlineBase):
|
||||||
"""Custom template that enables sorting for stacked inlines"""
|
"""Custom template that enables sorting for stacked inlines"""
|
||||||
if VERSION < (2, 0):
|
if VERSION >= (2, 0):
|
||||||
template = 'adminsortable/edit_inline/stacked-1.10.x.html'
|
template = 'adminsortable/edit_inline/stacked-1.10.x.html'
|
||||||
else:
|
else:
|
||||||
template = 'adminsortable/edit_inline/stacked.html'
|
template = 'adminsortable/edit_inline/stacked.html'
|
||||||
|
|
@ -374,7 +374,7 @@ class SortableStackedInline(StackedInline, SortableInlineBase):
|
||||||
|
|
||||||
class SortableGenericTabularInline(GenericTabularInline, SortableInlineBase):
|
class SortableGenericTabularInline(GenericTabularInline, SortableInlineBase):
|
||||||
"""Custom template that enables sorting for tabular inlines"""
|
"""Custom template that enables sorting for tabular inlines"""
|
||||||
if VERSION < (2, 0):
|
if VERSION >= (2, 0):
|
||||||
template = 'adminsortable/edit_inline/tabular-1.10.x.html'
|
template = 'adminsortable/edit_inline/tabular-1.10.x.html'
|
||||||
else:
|
else:
|
||||||
template = 'adminsortable/edit_inline/tabular.html'
|
template = 'adminsortable/edit_inline/tabular.html'
|
||||||
|
|
@ -382,7 +382,7 @@ class SortableGenericTabularInline(GenericTabularInline, SortableInlineBase):
|
||||||
|
|
||||||
class SortableGenericStackedInline(GenericStackedInline, SortableInlineBase):
|
class SortableGenericStackedInline(GenericStackedInline, SortableInlineBase):
|
||||||
"""Custom template that enables sorting for stacked inlines"""
|
"""Custom template that enables sorting for stacked inlines"""
|
||||||
if VERSION < (2, 0):
|
if VERSION >= (2, 0):
|
||||||
template = 'adminsortable/edit_inline/stacked-1.10.x.html'
|
template = 'adminsortable/edit_inline/stacked-1.10.x.html'
|
||||||
else:
|
else:
|
||||||
template = 'adminsortable/edit_inline/stacked.html'
|
template = 'adminsortable/edit_inline/stacked.html'
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,13 @@
|
||||||
{{ inline_admin_formset.formset.non_form_errors }}
|
{{ inline_admin_formset.formset.non_form_errors }}
|
||||||
|
|
||||||
{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
||||||
<h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="inlinechangelink">{% trans "Change" %}</a>{% endif %}
|
<h3>
|
||||||
|
{% if inline_admin_form.original %}
|
||||||
|
{% with initial_forms_count=inline_admin_formset.formset.management_form.INITIAL_FORMS.value %}
|
||||||
|
<i class="fa fa-{% if forloop.first %}sort-desc{% elif forloop.counter == initial_forms_count %}sort-asc{% else %}sort{% endif %}"></i>
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
<b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="inlinechangelink">{% trans "Change" %}</a>{% endif %}
|
||||||
{% else %}#{{ forloop.counter }}{% endif %}</span>
|
{% else %}#{{ forloop.counter }}{% endif %}</span>
|
||||||
{% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %}
|
{% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %}
|
||||||
{% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
|
{% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@
|
||||||
id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
||||||
<td class="original">
|
<td class="original">
|
||||||
{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
|
{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
|
||||||
|
{% with initial_forms_count=inline_admin_form.formset.management_form.INITIAL_FORMS.value %}
|
||||||
|
<i class="fa fa-{% if forloop.first %}sort-desc{% elif forloop.counter == initial_forms_count %}sort-asc{% else %}sort{% endif %}"></i>
|
||||||
|
{% endwith %}
|
||||||
{% if inline_admin_form.original %}
|
{% if inline_admin_form.original %}
|
||||||
{{ inline_admin_form.original }}
|
{{ inline_admin_form.original }}
|
||||||
{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="inlinechangelink">{% trans "Change" %}</a>{% endif %}
|
{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="inlinechangelink">{% trans "Change" %}</a>{% endif %}
|
||||||
|
|
@ -75,4 +78,4 @@
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue