Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    django-snippets 0.1.2

    Download button

    No screenshots available
    Downloads: 276  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Guilherme Gondim | More programs
    BSD License / FREE
    October 28th, 2009, 14:39 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    django-snippets description

    Provides a templatetag for Django acting as an {% include %}, but the template content comes from database

    django-snippets is a Django application that provides a templatetag called include_snippet for Django projects.

    Usage:

    Once you've created some instances of the snippets.models.Snippet model, you can load it it using the snippets templatetag-library:

    {% load snippets ... %}

    ...

    {% get_comment_list for entry as comment_list %}
    {% if comment_list %}
     < h2 >Comments< /h2 >
     < ol >{% include_snippet "comment_list" %}< /ol >
    {% endif %}


    This way you can include a snippet with the name "comment_list". If you have the name of a snippet in a template variable, leave out the quotes.

    comment_list will be rendered as a Django template. This mean that you can use {% for %}, {% if %} and others template tags.

    This tag also accepts an optional argument where you can specify the number of seconds, the that snippet should be cached:

    {% include_snippet "comment_list" 3600 %}

    If you use a snippet that doesn't exist, ``include_snippet`` will insert the value of the SNIPPET_STRING_IF_INVALID setting, which is '' (the empty string) by default.


    Product's homepage

    Requirements:

    · Python
    · Django

      


    TAGS:

    template tag | Django snippets | Django plugin | Django | snippets | template

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM