
def register(app):
  @app.template_filter("getattr")
  def jinja_getattr(obj, name, default=None):
      # Safe getattr: returns default if the attribute is missing
      return getattr(obj, name, default)
