diff --git a/README.md b/README.md index d878e46..1fdce02 100644 --- a/README.md +++ b/README.md @@ -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 '...' %}` | --- diff --git a/snippets/django-snippets.json b/snippets/django-snippets.json index e499dd7..1ed8f15 100644 --- a/snippets/django-snippets.json +++ b/snippets/django-snippets.json @@ -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" } }