Commit 71bd1bb0 authored by François Ferry's avatar François Ferry
Browse files

feat(museum): create Museum.title_with_city and use it in the view.

related: #2
parent 4db1f55d9454
Pipeline #26126 passed with stage
in 56 seconds
......@@ -16,3 +16,14 @@
# along with this program. If not, see <>.
"""cubicweb-tuto entity's classes"""
from cubicweb.entities import AnyEntity, fetch_config
class Museum(AnyEntity):
__regid__ = "Museum"
fetch_attrs, cw_fetch_order = fetch_config(["name"])
def title_with_city(self):
return f"{} ({self.is_in[0].name})"
......@@ -27,5 +27,4 @@ class MuseumPrimaryView(PrimaryView):
"""Renders the entity title, by default using entity's
:meth:`dc_title()` method.
city_name = entity.is_in[0].name
self.w(f"<h1>{} ({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