Replace custom template tag with django builtin variant.

pull/3413/merge
Tom Hendrikx 2017-03-22 15:12:15 +01:00 zatwierdzone przez Matt Westcott
rodzic 82a8202bb2
commit 12d8161e36
3 zmienionych plików z 4 dodań i 9 usunięć

Wyświetl plik

@ -1,10 +1,11 @@
{% load l10n %}
{% load wagtailadmin_tags %}
(function() {
var panel = InlinePanel({
formsetPrefix: "id_{{ self.formset.prefix }}",
emptyChildFormPrefix: "{{ self.empty_child.form.prefix }}",
canOrder: {% if can_order %}true{% else %}false{% endif %},
maxForms: {{ self.formset.max_num|no_thousand_separator }}
maxForms: {{ self.formset.max_num|unlocalize }}
});
{% for child in self.children %}

Wyświetl plik

@ -94,14 +94,6 @@ def ellipsistrim(value, max_length):
return value
@register.filter
def no_thousand_separator(num):
"""
Prevent USE_THOUSAND_SEPARATOR from automatically inserting a thousand separator on this value
"""
return str(num)
@register.filter
def fieldtype(bound_field):
try:

Wyświetl plik

@ -781,6 +781,7 @@ class TestInlinePanel(TestCase, WagtailTestUtils):
Test that the USE_THOUSAND_SEPARATOR setting does not screw up the rendering of numbers
(specifically maxForms=1000) in the JS initializer:
https://github.com/wagtail/wagtail/pull/2699
https://github.com/wagtail/wagtail/issues/3227
"""
SpeakerObjectList = ObjectList([
InlinePanel('speakers', label="Speakers", panels=[
@ -796,6 +797,7 @@ class TestInlinePanel(TestCase, WagtailTestUtils):
self.assertIn('maxForms: 1000', panel.render_js_init())
def test_invalid_inlinepanel_declaration(self):
with self.ignore_deprecation_warnings():
self.assertRaises(TypeError, lambda: InlinePanel(label="Speakers"))