Source code for django.template.loaders.base

[docs]defget_template(self,template_name,skip=None):""" Call self.get_template_sources() and return a Template object for the first template matching template_name. If skip is provided, ignore template origins in skip. This is used to avoid recursion during template extending. """tried=[]fororigininself.get_template_sources(template_name):ifskipisnotNoneandorigininskip:tried.append((origin,'Skipped'))continuetry:contents=self.get_contents(origin)exceptTemplateDoesNotExist:tried.append((origin,'Source does not exist'))continueelse:returnTemplate(contents,origin,origin.template_name,self.engine,)raiseTemplateDoesNotExist(template_name,tried=tried)

[docs]defget_template_sources(self,template_name):""" An iterator that yields possible matching template paths for a template name. """raiseNotImplementedError('subclasses of Loader must provide a get_template_sources() method')