/
Python (Django).sublime-completions
191 lines (190 loc) · 11.8 KB
/
Python (Django).sublime-completions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{
"scope": "source.python",
"completions":
[
// methods
{ "trigger": "get_absolute_url", "contents": "get_absolute_url()"},
{ "trigger": "save", "contents": "save()"},
// meta
{ "trigger": "abstract", "contents": "abstract = True"},
{ "trigger": "verbose_name_meta", "contents": "verbose_name = '$1'"},
{ "trigger": "app_label", "contents": "app_label = '$1'"},
{ "trigger": "db_table", "contents": "db_table = '$1'"},
{ "trigger": "get_latest_by", "contents": "get_latest_by = '$1'"},
{ "trigger": "managed", "contents": "managed = ${1:False}"},
{ "trigger": "order_with_respect_to", "contents": "order_with_respect_to = '$1'"},
{ "trigger": "permissions", "contents": "permissions = ('$1',)"},
{ "trigger": "proxy", "contents": "proxy = ${1:True}"},
{ "trigger": "unique_together", "contents": "unique_together = (('$1','$2'),)"},
// fields
{ "trigger": "null", "contents": "null=${1:True}"},
{ "trigger": "blank", "contents": "blank=${1:True}"},
{ "trigger": "choices", "contents": "choices=$1"},
{ "trigger": "db_column", "contents": "db_column='$1'"},
{ "trigger": "db_index", "contents": "db_index='$1'"},
{ "trigger": "db_tablespace", "contents": "db_tablespace='$1'"},
{ "trigger": "default", "contents": "default='$1'"},
{ "trigger": "editable", "contents": "editable=${1:False}"},
{ "trigger": "error_messages", "contents": "error_messages={'$1':$2}"},
{ "trigger": "help_text", "contents": "help_text='$1'"},
{ "trigger": "primary_key", "contents": "primary_key=True"},
{ "trigger": "unique", "contents": "unique=True"},
{ "trigger": "unique_for_date", "contents": "unique_for_date='$1'"},
{ "trigger": "verbose_name", "contents": "verbose_name='$1'"},
{ "trigger": "validators", "contents": "validators=['$1']"},
{ "trigger": "max_length", "contents": "max_length=$1"},
{ "trigger": "auto_now", "contents": "auto_now=True"},
{ "trigger": "auto_now_add", "contents": "auto_now_add=True"},
{ "trigger": "max_digits", "contents": "max_digits=$1"},
{ "trigger": "decimal_places", "contents": "decimal_places=$1"},
{ "trigger": "height_field", "contents": "height_field='$1'"},
{ "trigger": "width_field", "contents": "width_field='$1'"},
{ "trigger": "limit_choices_to", "contents": "limit_choices_to={'$1':$2}"},
{ "trigger": "related_name", "contents": "related_name='$1'"},
{ "trigger": "to_field", "contents": "to_field='$1'"},
{ "trigger": "on_delete", "contents": "on_delete=models.CASCADE"},
{ "trigger": "symmetrical", "contents": "symmetrical=${1:False}"},
{ "trigger": "through", "contents": "through='$1'"},
{ "trigger": "parent_link", "contents": "parent_link=${1:True}"},
// managers
{ "trigger": "use_for_related_fields", "contents": "use_for_related_fields = ${1:True}"},
// queryset
{ "trigger": "objects", "contents": "objects.all()"},
{ "trigger": "filter", "contents": "filter(${1:fileld}=$2)"},
{ "trigger": "exclude", "contents": "exclude(${1:fileld}=$2)"},
{ "trigger": "annotate", "contents": "annotate()"},
{ "trigger": "order_by", "contents": "order_by('$1')"},
{ "trigger": "reverse", "contents": "reverse()"},
{ "trigger": "distinct", "contents": "distinct()"},
{ "trigger": "values", "contents": "values()"},
{ "trigger": "values_list", "contents": "values_list('$1',)"},
{ "trigger": "get", "contents": "get('$1'=$2)"},
{ "trigger": "create", "contents": "create($1)"},
{ "trigger": "get_or_create", "contents": "$1, created = $2.objects.get_or_create($3)"},
{ "trigger": "bulk_create", "contents": "bulk_create([$1])"},
{ "trigger": "count", "contents": "count()"},
{ "trigger": "in_bulk", "contents": "in_bulk([$1])"},
{ "trigger": "iterator", "contents": "iterator()"},
{ "trigger": "latest", "contents": "latest('$1')"},
{ "trigger": "aggregate", "contents": "aggregate($1)"},
{ "trigger": "exists", "contents": "exists()"},
{ "trigger": "update", "contents": "update($1)"},
{ "trigger": "delete", "contents": "delete()"},
// field lookups
{ "trigger": "exact", "contents": "$1__exact=$2"},
{ "trigger": "iexact", "contents": "$1__iexact=$2"},
{ "trigger": "contains", "contents": "$1__contains=$2"},
{ "trigger": "icontains", "contents": "$1__icontains=$2"},
{ "trigger": "in", "contents": "$1__in=$2"},
{ "trigger": "gt", "contents": "$1__gt=$2"},
{ "trigger": "gte", "contents": "$1__gte=$2"},
{ "trigger": "lt", "contents": "$1__lt=$2"},
{ "trigger": "lte", "contents": "$1__lte=$2"},
{ "trigger": "starswith", "contents": "$1__starswith=$2"},
{ "trigger": "istarswith", "contents": "$1__istarswith=$2"},
{ "trigger": "endswith", "contents": "$1__endswith=$2"},
{ "trigger": "iendswith", "contents": "$1__iendswith=$2"},
{ "trigger": "range", "contents": "$1__range=($2,$3)"},
{ "trigger": "year", "contents": "$1__year=$2"},
{ "trigger": "month", "contents": "$1__month=$2"},
{ "trigger": "day", "contents": "$1__day=$2"},
{ "trigger": "weekday", "contents": "$1__weekday=$2"},
{ "trigger": "isnull", "contents": "$1__isnull=${2:True}"},
{ "trigger": "regex", "contents": "$1__regex=r'$2'"},
{ "trigger": "iregex", "contents": "$1__iregex=r'$2'"},
// Aggregation functions
{ "trigger": "Avg", "contents": "Avg('$1')"},
{ "trigger": "Count", "contents": "Count('$1', distinct=${2:False})"},
{ "trigger": "Max", "contents": "Max('$1')"},
{ "trigger": "Min", "contents": "Min('$1')"},
{ "trigger": "StdDev", "contents": "StdDev('$1')"},
{ "trigger": "Sum", "contents": "Sum('$1')"},
{ "trigger": "Variance", "contents": "Variance('$1')"},
// urls
{ "trigger": "url", "contents": "url(r'$1', $2, name='$3')," },
// shortcuts
{ "trigger": "render", "contents": "render(request, $1)"},
{ "trigger": "render_to_response", "contents": "render_to_response('$1', $1, context_instance=RequestContext(request))"},
{ "trigger": "redirect", "contents": "redirect($1)"},
{ "trigger": "get_object_or_404", "contents": "get_object_or_404($1, $2)"},
{ "trigger": "get_list_or_404", "contents": "get_list_or_404($1, $2)"},
// decorators
{ "trigger": "require_http_methods", "contents": "@require_http_methods(['POST', 'GET'])"},
{ "trigger": "require_GET", "contents": "@require_GET()"},
{ "trigger": "require_POST", "contents": "@require_POST()"},
{ "trigger": "require_safe", "contents": "@require_safe()"},
// forms
{ "trigger": "is_bound", "contents": "is_bound"},
{ "trigger": "is_valid", "contents": "is_valid()"},
{ "trigger": "initial", "contents": "initial={'$1':$2}"},
{ "trigger": "cleaned_data", "contents": "cleaned_data"},
{ "trigger": "as_p", "contents": "as_p()"},
{ "trigger": "as_ul", "contents": "as_ul()"},
{ "trigger": "as_table", "contents": "as_table()"},
{ "trigger": "auto_id", "contents": "auto_id=${1:False}"},
{ "trigger": "initial_field", "contents": "initial=$1"},
// admin
{ "trigger": "date_hierarchy", "contents": "date_hierarchy = '$1'"},
{ "trigger": "exclude_admin", "contents": "exclude = ('$1',)"},
{ "trigger": "fields_admin", "contents": "fields = ('$1',)"},
{ "trigger": "list_display", "contents": "list_display = ('$1',)"},
{ "trigger": "list_display_links", "contents": "list_display_links = ('$1',)"},
{ "trigger": "list_editable", "contents": "list_editable = ('$1',)"},
{ "trigger": "list_filter", "contents": "list_filter = ('$1',)"},
{ "trigger": "list_max_show_all", "contents": "list_max_show_all = ${1:200}"},
{ "trigger": "list_per_page", "contents": "list_per_page = ${1:100}"},
{ "trigger": "ordering", "contents": "ordering = ('$1',)"},
{ "trigger": "prepopulated_fields", "contents": "prepopulated_fields = {'${1:slug}': ('$2',)}"},
{ "trigger": "radio_fields", "contents": "radio_fields = {'$1': admin.HORIZONTAL}"},
{ "trigger": "raw_id_fields", "contents": "raw_id_fields = ('$1',)"},
{ "trigger": "readonly_fields", "contents": "readonly_fields = ('$1',)"},
{ "trigger": "save_as", "contents": "save_as = ${1:True}"},
{ "trigger": "save_on_top", "contents": "save_on_top = ${1:True}"},
{ "trigger": "search_fields", "contents": "search_fields = ('$1',)"}
// settings
// { "trigger": "ABSOLUTE_URL_OVERRIDES", "contents": "ABSOLUTE_URL_OVERRIDES = {}"},
// { "trigger": "ADMIN_FOR", "contents": "ADMIN_FOR = ()"},
// { "trigger": "_ADMINS", "contents": "ADMINS = (('$1','$2'),)"},
// { "trigger": "ALLOWED_INCLUDE_ROOTS", "contents": "ALLOWED_INCLUDE_ROOTS = ()"},
// { "trigger": "APPEND_SLASH", "contents": "APPEND_SLASH = ${1:True}"},
// { "trigger": "AUTHENTICATION_BACKENDS", "contents": "AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)"},
// { "trigger": "AUTH_PROFILE_MODULE", "contents": "AUTH_PROFILE_MODULE = '${1:app}.${2:Model}'"},
// { "trigger": "CACHE_MIDDLEWARE_ALIAS", "contents": "CACHE_MIDDLEWARE_ALIAS = '${1:default}'"},
// { "trigger": "CACHE_MIDDLEWARE_ANONYMOUS_ONLY", "contents": "CACHE_MIDDLEWARE_ANONYMOUS_ONLY = '${1:False}'"},
// { "trigger": "CACHE_MIDDLEWARE_KEY_PREFIX", "contents": "CACHE_MIDDLEWARE_KEY_PREFIX = '$1'"},
// { "trigger": "CACHE_MIDDLEWARE_SECONDS", "contents": "CACHE_MIDDLEWARE_SECONDS = ${1:600}"},
// { "trigger": "CSRF_COOKIE_DOMAIN", "contents": "CSRF_COOKIE_DOMAIN = '$1'"},
// { "trigger": "CSRF_COOKIE_NAME", "contents": "CSRF_COOKIE_NAME = '${1:csrftoken}'"},
// { "trigger": "CSRF_FAILURE_VIEW", "contents": "CSRF_FAILURE_VIEW = '${1:django.views.csrf.csrf_failure}'"},
// { "trigger": "DATE_FORMAT", "contents": "DATE_FORMAT = '${1:N j, Y}'"},
// { "trigger": "DATETIME_FORMAT", "contents": "DATETIME_FORMAT = '${1:N j, Y, P}'"},
// { "trigger": "DEBUG", "contents": "DEBUG = '${1:False'"},
// { "trigger": "DEBUG_PROPAGATE_EXCEPTIONS", "contents": "DEBUG_PROPAGATE_EXCEPTIONS = '${1:False'"},
// { "trigger": "DECIMAL_SEPARATOR", "contents": "DECIMAL_SEPARATOR = '${1:.'"},
// { "trigger": "DEFAULT_CHARSET", "contents": "DEFAULT_CHARSET = '${1:utf-8'"},
// { "trigger": "DEFAULT_CONTENT_TYPE", "contents": "DEFAULT_CONTENT_TYPE = '${1:text/html'"},
// { "trigger": "DEFAULT_FILE_STORAGE", "contents": "DEFAULT_FILE_STORAGE = '${1:django.core.files.storage.FileSystemStorage'"},
// { "trigger": "DEFAULT_FROM_EMAIL", "contents": "DEFAULT_FROM_EMAIL = '${1:webmaster@localhost'"},
// { "trigger": "DEFAULT_INDEX_TABLESPACE", "contents": "DEFAULT_INDEX_TABLESPACE = '$1'"},
// { "trigger": "DEFAULT_TABLESPACE", "contents": "DEFAULT_TABLESPACE = '$1'"},
// { "trigger": "DISALLOWED_USER_AGENTS", "contents": "DISALLOWED_USER_AGENTS = (r'$1',)"},
// { "trigger": "EMAIL_BACKEND", "contents": "EMAIL_BACKEND = '${1:django.core.mail.backends.smtp.EmailBackend}'"},
// { "trigger": "EMAIL_FILE_PATH", "contents": "EMAIL_FILE_PATH = '$1'"},
// { "trigger": "EMAIL_HOST", "contents": "EMAIL_HOST = '${1:localhost}'"},
// { "trigger": "EMAIL_HOST_PASSWORD", "contents": "EMAIL_HOST_PASSWORD = '$1'"},
// { "trigger": "EMAIL_HOST_USER", "contents": "EMAIL_HOST_USER = '$1'"},
// { "trigger": "EMAIL_PORT", "contents": "EMAIL_PORT = ${1:25}"},
// { "trigger": "EMAIL_SUBJECT_PREFIX", "contents": "EMAIL_SUBJECT_PREFIX = '${1:[django]}'"},
// { "trigger": "EMAIL_USE_TLS", "contents": "EMAIL_USE_TLS = '${1:False}'"},
// { "trigger": "FILE_CHARSET", "contents": "FILE_CHARSET = '${1:utf-8}'"},
// { "trigger": "FILE_UPLOAD_PERMISSIONS", "contents": "FILE_UPLOAD_PERMISSIONS = ${1:None}"},
// { "trigger": "FILE_UPLOAD_TEMP_DIR", "contents": "FILE_UPLOAD_TEMP_DIR = ${1:None}"},
// { "trigger": "FIRST_DAY_OF_WEEK", "contents": "FIRST_DAY_OF_WEEK = ${1:0}"},
// { "trigger": "FIXTURE_DIRS", "contents": "FIXTURE_DIRS = ($1,)"},
// { "trigger": "FORCE_SCRIPT_NAME", "contents": "FORCE_SCRIPT_NAME = '$1'"},
// { "trigger": "FORMAT_MODULE_PATH", "contents": "FORMAT_MODULE_PATH = '$1'"},
// { "trigger": "IGNORABLE_404_URLS", "contents": "IGNORABLE_404_URLS = ('$1',)"}
// // { "trigger": "IGNORABLE_404_URLS", "contents": "IGNORABLE_404_URLS = ('$1',)"},
// // { "trigger": "", "contents": ""}
]
}