views:

430

answers:

1

As "load" is far too generic for searching:

  1. What is the purpose of "load" and what does it do in this particular case? - in a template file, base_weblog.html,

    {% load weblog %}{% render_month_links %}

  2. Are some naming conventions used in order for "load" to do its job? E.g. names of folders and/or files and/or class names?

  3. Where is the documentation for "load" and can you elaborate?

Update 1: "weblog" after "load" (in template file django_website/templates/base_weblog.html) refers to file "weblog.py" in folder django_website/apps/blog/templatetags. Folder templatetags must be named exactly that and must contain a file named "__init__.py" (question 2).

Update 2: "load" makes the custom template tags (render_latest_blog_entries and render_month_links in this case) available for use in templates, django_website\templates\base_weblog.html in this case. "Load" is a security and performance function (question 1).


Details:

The example is from the source for http://www.djangoproject.com/ - direct download URL is through http://shrinkster.com/17g8.

Partial folder structure (items with no file extension are folders):

django_website

  apps
    accounts
    aggregator
    blog
      urls.py
      models.py
        class Entry(models.Model)

      templatetags
        weblog.py
    contact
    docs

  templates
    base_weblog.html

    aggregator
    blog
      entry_archive.html
      entry_archive_year.html
      month_links_snippet.html
      entry_archive_month.html
      entry_detail.html
      entry_snippet.html
      entry_archive_day.html
    comments
    contact
    docs
    feeds
    flatfiles
    flatpages
    registration
+4  A: 

load:

Load a custom template tag set.

See Custom tag and filter libraries for more information.

Paolo Bergantino
+1 - beat me to it!
Dominic Rodger