Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pkolt/django-snippets
Snippet for django
https://github.com/pkolt/django-snippets
Last synced: 7 days ago
JSON representation
Snippet for django
- Host: GitHub
- URL: https://github.com/pkolt/django-snippets
- Owner: pkolt
- Created: 2012-04-10T10:43:41.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-24T14:12:39.000Z (over 11 years ago)
- Last Synced: 2024-10-15T12:13:28.888Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 109 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
===============================
Snippets application for Django
===============================Depending
#########Python >= 2.6
Django >= 1.3
Installation
############1. ``snippets`` add INSTALLED_APPS
2. Run ``python manage.py syncdb``Settings
########Edit settings.py::
SNIPPETS_PREFIX = 'snippet_'
SNIPPETS = (
'snippets.container.StringSnippet',
'snippets.container.TextSnippet',
'snippets.container.HTMLSnippet',
'snippets.container.CSVSnippet',
'snippets.container.MarkdownSnippet',
)Formats
#######* String
* Text
* HTML
* CSV
* MarkdownCSV Snippet
***********Text::
1, Hello world!
2, Language: Python\, Ruby
3, Escape use \,In template::
{{ snippet_language.title }}
- {{ num }}) {{ text }}
{% for num, text in snippet_language.content %}
{% endfor %}
Result::
1) Hello world!
2) Language: Python, Ruby
3) Escape use ,
Templatetags
############
Load tags::
{% load snippets_tags %}
Snippet in template context::
{{ mysnippet.title }}
{{ mysnippet.content }} {# or #} {{ mysnippet }}
{{ mysnippet.raw_content }}
Snippet::
{% snippet "copyright" %} {# show copyright #}
{% snippet "copyright" as copyright %} {# add to context #}
Snippets group::
{% snippets_group "phone" %} {# add to context #}
{{ phone_jon }}, {{ phone_mark }}.
{% snippets_group "phone" as phone_list %}
{% for object in phone_list %}
{% endfor %}
Snippet use Shortcode
##################
Use the shortcode in the text ``[snippet name]``.
In the template, add a filter::
{{ object.text|snippet_shortcode }}
Changelog
#########
16.04.2012 — Release Snippets version 0.1.4
09.04.2012 — Release Snippets version 0.1.3
07.04.2012 — Release Snippets version 0.1.2
27.03.2012 — Release Snippets version 0.1.0