Fix hastattr typo.
Added missing base.html, fix base_template function.