Defining views with templates