Fix tabs not working with non-ASCII alphanumeric characters. #237
parent
42bf0f8039
commit
55f2c86a47
|
|
@ -18,14 +18,14 @@
|
||||||
{% if show_fieldsets_as_tabs %}
|
{% if show_fieldsets_as_tabs %}
|
||||||
{% for fieldset in adminform %}
|
{% for fieldset in adminform %}
|
||||||
{% with fieldset.name|default_if_none:opts.verbose_name as tab_name %}
|
{% with fieldset.name|default_if_none:opts.verbose_name as tab_name %}
|
||||||
<button type="button" id="tablink-{{ tab_name|slugify }}" class="tabbed-changeform-tablink {{ forloop.counter0|default:'active' }}" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|slugify }}')">
|
<button type="button" id="tablink-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tablink {{ forloop.counter0|default:'active' }}" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|admin_interface_slugify }}')">
|
||||||
{{ tab_name|capfirst }}
|
{{ tab_name|capfirst }}
|
||||||
</button>
|
</button>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% with opts.verbose_name as tab_name %}
|
{% with opts.verbose_name as tab_name %}
|
||||||
<button type="button" id="tablink-{{ tab_name|slugify }}" class="tabbed-changeform-tablink active" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|slugify }}')">
|
<button type="button" id="tablink-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tablink active" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|admin_interface_slugify }}')">
|
||||||
{{ tab_name|capfirst }}
|
{{ tab_name|capfirst }}
|
||||||
</button>
|
</button>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
{% if show_inlines_as_tabs %}
|
{% if show_inlines_as_tabs %}
|
||||||
{% for inline_admin_formset in inline_admin_formsets %}
|
{% for inline_admin_formset in inline_admin_formsets %}
|
||||||
{% with inline_admin_formset.opts.verbose_name_plural as tab_name %}
|
{% with inline_admin_formset.opts.verbose_name_plural as tab_name %}
|
||||||
<button type="button" id="tablink-{{ tab_name|slugify }}" class="tabbed-changeform-tablink" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|slugify }}')">
|
<button type="button" id="tablink-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tablink" onclick="AdminInterface.tabbedChangeForm.openTab(event, '{{ tab_name|admin_interface_slugify }}')">
|
||||||
{{ tab_name|capfirst }}
|
{{ tab_name|capfirst }}
|
||||||
</button>
|
</button>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
@ -48,14 +48,14 @@
|
||||||
{% if show_fieldsets_as_tabs %}
|
{% if show_fieldsets_as_tabs %}
|
||||||
{% for fieldset in adminform %}
|
{% for fieldset in adminform %}
|
||||||
{% with fieldset.name|default_if_none:opts.verbose_name as tab_name %}
|
{% with fieldset.name|default_if_none:opts.verbose_name as tab_name %}
|
||||||
<div id="tabcontent-{{ tab_name|slugify }}" class="tabbed-changeform-tabcontent {{ forloop.counter0|default:'active' }}">
|
<div id="tabcontent-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tabcontent {{ forloop.counter0|default:'active' }}">
|
||||||
{% include "admin/includes/headerless_fieldset.html" %}
|
{% include "admin/includes/headerless_fieldset.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% with opts.verbose_name as tab_name %}
|
{% with opts.verbose_name as tab_name %}
|
||||||
<div id="tabcontent-{{ tab_name|slugify }}" class="tabbed-changeform-tabcontent active">
|
<div id="tabcontent-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tabcontent active">
|
||||||
{% for fieldset in adminform %}
|
{% for fieldset in adminform %}
|
||||||
{% include "admin/includes/fieldset.html" %}
|
{% include "admin/includes/fieldset.html" %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
{% for inline_admin_formset in inline_admin_formsets %}
|
{% for inline_admin_formset in inline_admin_formsets %}
|
||||||
{% with inline_admin_formset.opts.verbose_name_plural as tab_name %}
|
{% with inline_admin_formset.opts.verbose_name_plural as tab_name %}
|
||||||
<div id="tabcontent-{{ tab_name|slugify }}" class="tabbed-changeform-tabcontent">
|
<div id="tabcontent-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tabcontent">
|
||||||
{% get_admin_interface_inline_template inline_admin_formset.opts.template as inline_template %}
|
{% get_admin_interface_inline_template inline_admin_formset.opts.template as inline_template %}
|
||||||
{% include inline_template %}
|
{% include inline_template %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from django.conf import settings
|
||||||
from django.contrib.admin.utils import get_fields_from_path
|
from django.contrib.admin.utils import get_fields_from_path
|
||||||
from django.urls import NoReverseMatch, reverse
|
from django.urls import NoReverseMatch, reverse
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
|
from slugify import slugify
|
||||||
|
|
||||||
from admin_interface.cache import get_cached_active_theme, set_cached_active_theme
|
from admin_interface.cache import get_cached_active_theme, set_cached_active_theme
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
|
|
@ -172,3 +173,8 @@ def admin_interface_use_changeform_tabs(adminform, inline_forms):
|
||||||
has_inline_tabs = theme.show_inlines_as_tabs and len(inline_forms) > 0
|
has_inline_tabs = theme.show_inlines_as_tabs and len(inline_forms) > 0
|
||||||
has_tabs = has_fieldset_tabs or has_inline_tabs
|
has_tabs = has_fieldset_tabs or has_inline_tabs
|
||||||
return has_tabs
|
return has_tabs
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def admin_interface_slugify(name):
|
||||||
|
return slugify(str(name or ""))
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ classifiers = [
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"django-colorfield >= 0.8.0, < 1.0.0",
|
"django-colorfield >= 0.8.0, < 1.0.0",
|
||||||
|
"python-slugify >= 7.0.0, < 9.0.0",
|
||||||
]
|
]
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
django >= 2.2
|
django >= 2.2
|
||||||
django-colorfield == 0.8.0
|
django-colorfield == 0.8.0
|
||||||
|
python-slugify == 8.0.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue