@register.inclusion_tag('angular/angular_templates.html', takes_context=True)
def angular_templates(context):
 template_paths = context['HORIZON_CONFIG']['external_templates']
 all_theme_static_files = context['HORIZON_CONFIG']['theme_static_files']
 this_theme_static_files = all_theme_static_files[context['THEME']]
 template_overrides = this_theme_static_files['template_overrides']
 angular_templates = {}
 for relative_path in template_paths:
  template_static_path = (context['STATIC_URL'] + relative_path)
  if (relative_path in template_overrides):
   relative_path = template_overrides[relative_path]
  result = []
  for finder in finders.get_finders():
   result.extend(finder.find(relative_path, True))
  path = result[(-1)]
  try:
   with open(path) as template_file:
    angular_templates[template_static_path] = template_file.read()
  except (OSError, IOError):
   pass
 templates = [(key, value) for (key, value) in angular_templates.items()]
 templates.sort(key=(lambda item: item[0]))
 return {'angular_templates': templates}

@ register . inclusion_tag ( 'angular/angular_templates.html' , takes_context = True ) def angular_templates ( context ) : template_paths = context [ 'HORIZON_CONFIG' ] [ 'external_templates' ] all_theme_static_files = context [ 'HORIZON_CONFIG' ] [ 'theme_static_files' ] this_theme_static_files = all_theme_static_files [ context [ 'THEME' ] ] template_overrides = this_theme_static_files [ 'template_overrides' ] angular_templates = { } for relative_path in template_paths : template_static_path = ( context [ 'STATIC_URL' ] + relative_path ) if ( relative_path in template_overrides ) : relative_path = template_overrides [ relative_path ] result = [ ] for finder in finders . get_finders ( ) : result . extend ( finder . find ( relative_path , True ) ) path = result [ ( - 1 ) ] try : with open ( path ) as template_file : angular_templates [ template_static_path ] = template_file . read ( ) except ( OSError , IOError ) : pass templates = [ ( key , value ) for ( key , value ) in angular_templates . items ( ) ] templates . sort ( key = ( lambda item : item [ 0 ] ) ) return { 'angular_templates' : templates }
for all static html templates .