How can one format django template in Sublime Text. My template consists of:
{{ variable }}
and {% stuff %}
)Is there a way to get same kind of formatting PyCharm provides?
If you're looking for a Django-specific plugin for Sublime Text I can recommend Djaneiro. Its main features are adding: syntax highlighting for Django HTML templates; and. code completion snippets for Django HTML templates and Python files.
To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.
{% %} and {{ }} are part of Django templating language. They are used to pass the variables from views to template. {% %} is basically used when you have an expression and are called tags while {{ }} is used to simply access the variable.
The Django template language doesn't have an equivalent of Jinja2 tests.
A couple different things:
Djanerio has a nice set of auto-completion and color schemes specific to Django. Check out their README file to see the list of available substitutions
JSFormat is also great for javascript in ST2, for your templates
Colorpicker offers a generic css color sheet that you can tinker with. This comes in handy for things all of the above doesn't pick up on.
This package should help: https://github.com/squ1b3r/Djaneiro
Here are some tips on install: How to install plugins to Sublime Text 2 editor?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With