Note: the tools to convert the sublime snippets has been extracted to their own repo: https://github.com/brmc/shortbus
This is a port of the Djaneiro plugin for Sublime Text to Jetbrains'
Pycharm IDE.
It's a collection of live templates for common patterns encountered
when building Django applications (with a couple generic python uses)
specifically useful for models, forms, widgets, views, and templates.
This was originally a pure port of the plugin, but new features have
been added not found in the original plugin. The Sublime text plugin can be
found here: https://github.com/squ1b3r/Djaneiro
In addition to what is listed there, the pycharm plugin includes templates
for:
* Postgres models and forms
* Widgets
* Settings
* Other missing fields found in django 1.10
- pycharm or jetbrains IDE with python plugin. (pycharm professional or
intellij ultimate is required to recognize the django-template context)
The plugin can be installed directly from the jetbrains plugin repositories
- Added live templates for django settings
- Migrated to python 3.6 with no plans for backwards compatibility
- fixed bug in postgres fields. they no longer expand to one giant variable
- removed duplication of
fip
- Updated templates from upstream
- Included missing fields for models and forms
- Added Postgres model and form fields
- Added Widgets
Added transpiler to convert between sublime text and jetbrainsCreated yml format to write live templates
Minor changes:
- Added
$END$ variables to all templates
- converted to an official plugin
- ported expansions for models, forms, completions, templates, and general
python
In either *.py or *.html files, type an abbreviation and press <TAB>.
Check here for a list of all the abbreviations/snippets:
https://github.com/squ1b3r/Djaneiro
See below for a list of abbreviations not
included with the original plugin
This section notes the features not found in the sublime text plugin.
A full listing of all the abbreviations in the docs
###Models
abbreviation | template |
---|---|
mbigauto |
|
mbin |
|
mdur |
|
mgip |
|
mip |
|
muuid |
|
###Forms
abbreviation | template |
---|---|
fgip |
|
fip |
|
fuuid |
|
###Postgres
abbreviation | template |
---|---|
farray |
|
fdaterange |
|
fdatetimerange |
|
ffloatrange |
|
fhstore |
|
fintrange |
|
fjson |
|
fsplitarray |
|
abbreviation | template |
---|---|
marray |
|
mbigintrange |
|
mdaterange |
|
mdatetimerange |
|
mfloatrange |
|
mhstore |
|
mintrange |
|
mjson |
|
###Widgets
abbreviation | template |
---|---|
wcheck |
|
wcheckmulti |
|
wclearablefile |
|
wdate |
|
wdatetime |
|
wemail |
|
wfile |
|
whidden |
|
wmultihidden |
|
wnullbool |
|
wnum |
|
wpass |
|
wradio |
|
wselect |
|
wselectdate |
|
wselectmulti |
|
wsplitdatetime |
|
wsplithiddendatetime |
|
wtext |
|
wtextarea |
|
wtime |
|
wurl |
|
###Settings
Live templates are provided for all Django settings. The convention here
is to lowercase the settings name and prefix it with an s. Most of
them are one line, but the ones that are most useful are for the more
complex settings, specifically slogging
and sdatabases
. They
both come with sub-templates that only meaningful in the appropriate
context:
slogfilter
slogfiltercallback
slogfilterdebugfalse
slogfilterdebugtrue
slogformatter
slogformatterserver
slogger
sloghandler
sloghandleremail
sloghandlerstream
sdatabase
sdatabasetest
###Settings
abbreviation | template |
---|---|
sabsolute_url_overrides | ABSOLUTE_URL_OVERRIDES = $VAR1$ $END$ |
sadmins | ADMINS = [('$VAR1$', '$VAR2$'), ]$END$ |
sallowed_hosts | ALLOWED_HOSTS = $VAR1$ $END$ |
sappend_slash | APPEND_SLASH = $VAR1$ $END$ |
sauth_password_validators | AUTH_PASSWORD_VALIDATORS = $VAR1$ $END$ |
sauth_user_model | AUTH_USER_MODEL = '$VAR1$' $END$ |
sauthentication_backends | AUTHENTICATION_BACKENDS = $VAR1$ $END$ |
scache_middleware_alias | CACHE_MIDDLEWARE_ALIAS = '$VAR1$' $END$ |
scache_middleware_key_prefix | CACHE_MIDDLEWARE_KEY_PREFIX = '$VAR1$' $END$ |
scache_middleware_seconds | CACHE_MIDDLEWARE_SECONDS = $VAR1$ $END$ |
scaches |
|
scsrf_cookie_age | CSRF_COOKIE_AGE = $VAR1$ $END$ |
scsrf_cookie_domain | CSRF_COOKIE_DOMAIN = $VAR1$ $END$ |
scsrf_cookie_httponly | CSRF_COOKIE_HTTPONLY = $VAR1$ $END$ |
scsrf_cookie_name | CSRF_COOKIE_NAME = '$VAR1$' $END$ |
scsrf_cookie_path | CSRF_COOKIE_PATH = '$VAR1$' $END$ |
scsrf_cookie_secure | CSRF_COOKIE_SECURE = $VAR1$ $END$ |
scsrf_failure_view | CSRF_FAILURE_VIEW = '$VAR1$' $END$ |
scsrf_header_name | CSRF_HEADER_NAME = '$VAR1$' $END$ |
scsrf_trusted_origins | CSRF_TRUSTED_ORIGINS = $VAR1$ $END$ |
sdata_upload_max_memory_size | DATA_UPLOAD_MAX_MEMORY_SIZE = $VAR1$ $END$ |
sdata_upload_max_number_fields | DATA_UPLOAD_MAX_NUMBER_FIELDS = $VAR1$ $END$ |
sdatabase | '$DBNAME$': { |
sdatabase_routers | DATABASE_ROUTERS = $VAR1$ $END$ |
sdatabases | DATABASES = { |
sdatabasetest | 'TEST': { |
sdate_format | DATE_FORMAT = '$VAR1$' $END$ |
sdate_input_formats | DATE_INPUT_FORMATS = [ |
sdatetime_format | DATETIME_FORMAT = '$VAR1$' $END$ |
sdatetime_input_formats | DATETIME_INPUT_FORMATS = [ |
sdebug | DEBUG = $VAR1$ $END$ |
sdebug_propagate_exceptions | DEBUG_PROPAGATE_EXCEPTIONS = $VAR1$ $END$ |
sdecimal_separator | DECIMAL_SEPARATOR = '$VAR1$' $END$ |
sdefault_charset | DEFAULT_CHARSET = '$VAR1$' $END$ |
sdefault_content_type | DEFAULT_CONTENT_TYPE = '$VAR1$' $END$ |
sdefault_exception_reporter_filter | DEFAULT_EXCEPTION_REPORTER_FILTER = '$VAR1$' $END$ |
sdefault_file_storage | DEFAULT_FILE_STORAGE = '$VAR1$' $END$ |
sdefault_from_email | DEFAULT_FROM_EMAIL = '$VAR1$' $END$ |
sdefault_index_tablespace | DEFAULT_INDEX_TABLESPACE = '$VAR1$' $END$ |
sdefault_tablespace | DEFAULT_TABLESPACE = '$VAR1$' $END$ |
sdisallowed_user_agents | DISALLOWED_USER_AGENTS = $VAR1$ $END$ |
semail_backend | EMAIL_BACKEND = '$VAR1$' $END$ |
semail_host | EMAIL_HOST = '$VAR1$' $END$ |
semail_host_password | EMAIL_HOST_PASSWORD = '$VAR1$' $END$ |
semail_host_user | EMAIL_HOST_USER = '$VAR1$' $END$ |
semail_port | EMAIL_PORT = $VAR1$ $END$ |
semail_ssl_certfile | EMAIL_SSL_CERTFILE = $VAR1$ $END$ |
semail_ssl_keyfile | EMAIL_SSL_KEYFILE = $VAR1$ $END$ |
semail_subject_prefix | EMAIL_SUBJECT_PREFIX = '$VAR1$' $END$ |
semail_timeout | EMAIL_TIMEOUT = $VAR1$ $END$ |
semail_use_ssl | EMAIL_USE_SSL = $VAR1$ $END$ |
semail_use_tls | EMAIL_USE_TLS = $VAR1$ $END$ |
sfile_charset | FILE_CHARSET = '$VAR1$' $END$ |
sfile_upload_directory_permissions | FILE_UPLOAD_DIRECTORY_PERMISSIONS = $VAR1$ $END$ |
sfile_upload_handlers | FILE_UPLOAD_HANDLERS = [ |
sfile_upload_max_memory_size | FILE_UPLOAD_MAX_MEMORY_SIZE = $VAR1$ $END$ |
sfile_upload_permissions | FILE_UPLOAD_PERMISSIONS = $VAR1$ $END$ |
sfile_upload_temp_dir | FILE_UPLOAD_TEMP_DIR = $VAR1$ $END$ |
sfirst_day_of_week | FIRST_DAY_OF_WEEK = $VAR1$ $END$ |
sfixture_dirs | FIXTURE_DIRS = [$VAR1$] $END$ |
sforce_script_name | FORCE_SCRIPT_NAME = $VAR1$ $END$ |
sformat_module_path | FORMAT_MODULE_PATH = $VAR1$ $END$ |
signorable_404_urls | IGNORABLE_404_URLS = $VAR1$ $END$ |
sinstalled_apps | INSTALLED_APPS = $VAR1$ $END$ |
sinternal_ips | INTERNAL_IPS = $VAR1$ $END$ |
slanguage_code | LANGUAGE_CODE = '$VAR1$' $END$ |
slanguage_cookie_age | LANGUAGE_COOKIE_AGE = $VAR1$ $END$ |
slanguage_cookie_domain | LANGUAGE_COOKIE_DOMAIN = $VAR1$ $END$ |
slanguage_cookie_name | LANGUAGE_COOKIE_NAME = '$VAR1$' $END$ |
slanguage_cookie_path | LANGUAGE_COOKIE_PATH = '$VAR1$' $END$ |
slanguages | LANGUAGES = [ |
slanguages_bidi | LANGUAGES_BIDI = ["he", "ar", "fa", "ur", $VAR1$] $END$ |
slocale_paths | LOCALE_PATHS = $VAR1$ $END$ |
slogfilter | '$VAR1$': { |
slogfiltercallback | '$VAR1$': { |
slogfilterdebugfalse | '$VAR1$': { |
slogfilterdebugtrue | '$VAR1$': { |
slogformatter | '$VAR1$': { |
slogformatterserver | '$VAR1$': { |
slogger | '$VAR1$': { |
slogging | LOGGING = { |
slogging_config | LOGGING_CONFIG = '$VAR1$' $END$ |
sloghandler | '$VAR1$': { |
sloghandleremail | '$VAR1$': { |
sloghandlerstream | '$VAR1$': { |
slogin_redirect_url | LOGIN_REDIRECT_URL = '$VAR1$' $END$ |
slogin_url | LOGIN_URL = '$VAR1$' $END$ |
slogout_redirect_url | LOGOUT_REDIRECT_URL = $VAR1$ $END$ |
smanagers | MANAGERS = $VAR1$ $END$ |
smedia_root | MEDIA_ROOT = '$VAR1$' $END$ |
smedia_url | MEDIA_URL = '$VAR1$' $END$ |
smessage_level | MESSAGE_LEVEL = $VAR1$ $END$ |
smessage_storage | MESSAGE_STORAGE = '$VAR1$' $END$ |
smessage_tags | MESSAGE_TAGS = { |
smiddleware | MIDDLEWARE = [ |
smiddleware_classes | MIDDLEWARE_CLASSES = [ |
smigration_modules | MIGRATION_MODULES = $VAR1$ $END$ |
smonth_day_format | MONTH_DAY_FORMAT = '$VAR1$' $END$ |
snumber_grouping | NUMBER_GROUPING = $VAR1$ $END$ |
spassword_hashers | PASSWORD_HASHERS = [ |
spassword_reset_timeout_days | PASSWORD_RESET_TIMEOUT_DAYS = $VAR1$ $END$ |
sprepend_www | PREPEND_WWW = $VAR1$ $END$ |
sroot_urlconf | ROOT_URLCONF = '$VAR1$' |
ssecret_key | SECRET_KEY = '$VAR1$' $END$ |
ssecure_browser_xss_filter | SECURE_BROWSER_XSS_FILTER = $VAR1$ $END$ |
ssecure_content_type_nosniff | SECURE_CONTENT_TYPE_NOSNIFF = $VAR1$ $END$ |
ssecure_hsts_include_subdomains | SECURE_HSTS_INCLUDE_SUBDOMAINS = $VAR1$ $END$ |
ssecure_hsts_seconds | SECURE_HSTS_SECONDS = $VAR1$ $END$ |
ssecure_proxy_ssl_header | SECURE_PROXY_SSL_HEADER = $VAR1$ $END$ |
ssecure_redirect_exempt | SECURE_REDIRECT_EXEMPT = $VAR1$ $END$ |
ssecure_ssl_host | SECURE_SSL_HOST = $VAR1$ $END$ |
ssecure_ssl_redirect | SECURE_SSL_REDIRECT = $VAR1$ $END$ |
sserialization_modules | SERIALIZATION_MODULES = {'$VAR1$' '$VAR2$'} |
sserver_email | SERVER_EMAIL = '$VAR1$' $END$ |
ssession_cache_alias | SESSION_CACHE_ALIAS = '$VAR1$' $END$ |
ssession_cookie_age | SESSION_COOKIE_AGE = $VAR1$ $END$ |
ssession_cookie_domain | SESSION_COOKIE_DOMAIN = $VAR1$ $END$ |
ssession_cookie_httponly | SESSION_COOKIE_HTTPONLY = $VAR1$ $END$ |
ssession_cookie_name | SESSION_COOKIE_NAME = '$VAR1$' $END$ |
ssession_cookie_path | SESSION_COOKIE_PATH = '$VAR1$' $END$ |
ssession_cookie_secure | SESSION_COOKIE_SECURE = $VAR1$ $END$ |
ssession_engine | SESSION_ENGINE = '$VAR1$' $END$ |
ssession_expire_at_browser_close | SESSION_EXPIRE_AT_BROWSER_CLOSE = $VAR1$ $END$ |
ssession_file_path | SESSION_FILE_PATH = $VAR1$ $END$ |
ssession_save_every_request | SESSION_SAVE_EVERY_REQUEST = $VAR1$ $END$ |
ssession_serializer | SESSION_SERIALIZER = '$VAR1$' $END$ |
sshort_date_format | SHORT_DATE_FORMAT = '$VAR1$' $END$ |
sshort_datetime_format | SHORT_DATETIME_FORMAT = '$VAR1$' $END$ |
ssigning_backend | SIGNING_BACKEND = '$VAR1$' $END$ |
ssilenced_system_checks | SILENCED_SYSTEM_CHECKS = $VAR1$ $END$ |
ssite_id | SITE_ID = $VAR1$ |
sstatic_files_finders | STATICFILES_FINDERS = [ |
sstatic_root | STATIC_ROOT = $VAR1$ $END$ |
sstatic_url | STATIC_URL = '$VAR1$' $END$ |
sstaticfiles_dirs | STATICFILES_DIRS = [$VAR1$] $END$ |
sstaticfiles_storage | STATICFILES_STORAGE = '$VAR1$' $END$ |
stemplates | TEMPLATES = [ |
stest_non_serialized_apps | TEST_NON_SERIALIZED_APPS = $VAR1$ $END$ |
stest_runner | TEST_RUNNER = '$VAR1$' $END$ |
sthousand_separator | THOUSAND_SEPARATOR = '$VAR1$' $END$ |
stime_format | TIME_FORMAT = '$VAR1$' $END$ |
stime_input_formats | TIME_INPUT_FORMATS = [ |
stime_zone | TIME_ZONE = '$VAR1$' $END$ |
suse_etags | USE_ETAGS = $VAR1$ $END$ |
suse_i18n | USE_I18N = $VAR1$ $END$ |
suse_l10n | USE_L10N = $VAR1$ $END$ |
suse_thousand_separator | USE_THOUSAND_SEPARATOR = $VAR1$ $END$ |
suse_tz | USE_TZ = $VAR1$ $END$ |
suse_x_forwarded_host | USE_X_FORWARDED_HOST = $VAR1$ $END$ |
suse_x_forwarded_port | USE_X_FORWARDED_PORT = $VAR1$ $END$ |
swsgi_application | WSGI_APPLICATION = $VAR1$ $END$ |
sx_frame_options | X_FRAME_OPTIONS = '$VAR1$' $END$ |
syear_month_format | YEAR_MONTH_FORMAT = '$VAR1$' $END$ |