Add support for DB-based templates