Commit b02c73df authored by François Ferry's avatar François Ferry

feat(museum): add city name to museum view

related: #2
parent 0b5b484402dd
......@@ -16,3 +16,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto views/forms/actions/components for web ui"""
from cubicweb.predicates import is_instance
from cubicweb.web.views.primary import PrimaryView
class MuseumPrimaryView(PrimaryView):
__select__ = is_instance("Museum")
def render_entity_title(self, entity):
"""Renders the entity title, by default using entity's
:meth:`dc_title()` method.
"""
city_name = entity.is_in[0].name
self.w(f"<h1>{entity.name} ({city_name})</h1>")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment