kopia lustrzana https://github.com/wagtail/wagtail
only append model type to button when there is one target model (#5094)
rodzic
388c8231c1
commit
fdbd7ca2d3
|
@ -31,6 +31,7 @@ Changelog
|
|||
* Fix: Unclear error message when saving image after focal point edit (Hugo van den Berg)
|
||||
* Fix: `send_mail` now correctly uses the `html_message` kwarg for HTML messages (Tiago Requeijo)
|
||||
* Fix: Page copying no longer allowed if page model has reached its `max_count` (Andy Babic)
|
||||
* Fix: Don't show page type on page chooser button when multiple types are allowed (Thijs Kramer)
|
||||
|
||||
|
||||
2.4 (19.12.2018)
|
||||
|
|
|
@ -47,6 +47,7 @@ Bug fixes
|
|||
* Increase max length on ``Embed.thumbnail_url`` to 255 characters (Kevin Howbrook)
|
||||
* ``send_mail`` now correctly uses the ``html_message`` kwarg for HTML messages (Tiago Requeijo)
|
||||
* Page copying no longer allowed if page model has reached its ``max_count`` (Andy Babic)
|
||||
* Don't show page type on page chooser button when multiple types are allowed (Thijs Kramer)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
|
|
|
@ -76,7 +76,7 @@ class TestAdminPageChooserWidget(TestCase):
|
|||
)
|
||||
|
||||
html = widget.render_html('test', self.child_page, {})
|
||||
self.assertIn(">Choose a page (Simple Page, Event Page)<", html)
|
||||
self.assertIn(">Choose a page<", html)
|
||||
|
||||
def test_render_js_init_with_can_choose_root(self):
|
||||
widget = widgets.AdminPageChooser(can_choose_root=True)
|
||||
|
|
|
@ -171,9 +171,9 @@ class AdminPageChooser(AdminChooser):
|
|||
super().__init__(**kwargs)
|
||||
|
||||
if target_models:
|
||||
models = ', '.join([model._meta.verbose_name.title() for model in target_models if model is not Page])
|
||||
if models:
|
||||
self.choose_one_text += ' (' + models + ')'
|
||||
model_names = [model._meta.verbose_name.title() for model in target_models if model is not Page]
|
||||
if len(model_names) == 1:
|
||||
self.choose_one_text += ' (' + model_names[0] + ')'
|
||||
|
||||
self.user_perms = user_perms
|
||||
self.target_models = list(target_models or [Page])
|
||||
|
|
Ładowanie…
Reference in New Issue