diff --git a/src/wuttaweb/views/master.py b/src/wuttaweb/views/master.py index 5f48e50..949a0e1 100644 --- a/src/wuttaweb/views/master.py +++ b/src/wuttaweb/views/master.py @@ -3898,6 +3898,13 @@ class MasterView(View): # pylint: disable=too-many-public-methods if hasattr(cls, "row_model_title_plural"): return cls.row_model_title_plural + if model_class := cls.get_row_model_class(): + if hasattr(model_class, "__wutta_hint__"): + if model_title_plural := model_class.__wutta_hint__.get( + "model_title_plural" + ): + return model_title_plural + row_model_title = cls.get_row_model_title() return f"{row_model_title}s" diff --git a/tests/views/test_master.py b/tests/views/test_master.py index 58d1c29..bb31e8c 100644 --- a/tests/views/test_master.py +++ b/tests/views/test_master.py @@ -396,6 +396,11 @@ class TestMasterView(WebTestCase): with patch.object(mod.MasterView, "row_model_class", new=MyModel, create=True): self.assertEqual(mod.MasterView.get_row_model_title_plural(), "Dinosaurs") + # model class may have wutta hint + MyModel.__wutta_hint__ = {"model_title_plural": "T-Rexes"} + with patch.object(mod.MasterView, "row_model_class", new=MyModel): + self.assertEqual(mod.MasterView.get_row_model_title_plural(), "T-Rexes") + ############################## # support methods ##############################