Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ All snippets use the `pt` prefix (short for "Python Template"). Here's the compl
| `ptd-stat` | Static file | `{% static 'path/to/file' %}` |
| `ptd-inc` | Include template | `{% include 'template.html' %}` |
| `ptd-firstof` | First of variables | `{% firstof var1 var2 %}` |
| `ptd-csrf` | CSRF token | `{% csrf_token %}` |
| `ptd-sup` | Block super | `{{ block.super }}` |
| `ptd-com` | Comment block | `{% comment 'note' %}...{% endcomment %}` |
| `ptd-ver` | Verbatim block | `{% verbatim %}...{% endverbatim %}` |
| `ptd-trans` | Translate string | `{% translate '...' %}` |

---

Expand Down
43 changes: 43 additions & 0 deletions snippets/django-snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,48 @@
"prefix": "ptd-firstof",
"body": ["{% firstof $1 $2 %}$0"],
"description": "Adds Firstof Block"
},

"Django - CSRF Token": {
"scope": "html",
"prefix": "ptd-csrf",
"body": ["{% csrf_token %}$0"],
"description": "Adds CSRF Token block"
},

"Django - Block Super": {
"scope": "html",
"prefix": "ptd-sup",
"body": ["{{ block.super }}$0"],
"description": "Access parent block content"
},

"Django - Comment Block": {
"scope": "html",
"prefix": "ptd-com",
"body": [
"{% comment '$1' %}",
"\t$0",
"{% endcomment %}"
],
"description": "Adds Django comment block"
},

"Django - Verbatim Block": {
"scope": "html",
"prefix": "ptd-ver",
"body": [
"{% verbatim %}",
"\t$0",
"{% endverbatim %}"
],
"description": "Prevents Django from rendering contents (useful for JS frameworks)"
},

"Django - Translate": {
"scope": "html",
"prefix": "ptd-trans",
"body": ["{% translate '$1' %}$0"],
"description": "Translate string"
}
}