kopia lustrzana https://github.com/wagtail/wagtail
Replace custom template tag with django builtin variant.
rodzic
82a8202bb2
commit
12d8161e36
|
@ -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 %}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"))
|
||||
|
|
Ładowanie…
Reference in New Issue