working rendering template from database