File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 2626 'example' ,
2727]
2828
29+ TEMPLATES = [
30+ {
31+ 'BACKEND' : 'django.template.backends.django.DjangoTemplates' ,
32+ 'DIRS' : [
33+ # insert your TEMPLATE_DIRS here
34+ ],
35+ 'APP_DIRS' : True ,
36+ 'OPTIONS' : {
37+ 'context_processors' : [
38+ # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
39+ # list if you haven't customized them:
40+ 'django.contrib.auth.context_processors.auth' ,
41+ 'django.template.context_processors.debug' ,
42+ 'django.template.context_processors.i18n' ,
43+ 'django.template.context_processors.media' ,
44+ 'django.template.context_processors.static' ,
45+ 'django.template.context_processors.tz' ,
46+ 'django.contrib.messages.context_processors.messages' ,
47+ ],
48+ },
49+ },
50+ ]
51+
2952STATIC_URL = '/static/'
3053
3154ROOT_URLCONF = 'example.urls'
Original file line number Diff line number Diff line change @@ -152,14 +152,16 @@ def to_representation(self, value):
152152 resource_type = resource_type if resource_type else get_resource_type_from_instance (value )
153153 return OrderedDict ([('type' , resource_type ), ('id' , str (pk ))])
154154
155- @property
156- def choices (self ):
155+ def get_choices (self , cutoff = None ):
157156 queryset = self .get_queryset ()
158157 if queryset is None :
159158 # Ensure that field.choices returns something sensible
160159 # even when accessed with a read-only field.
161160 return {}
162161
162+ if cutoff is not None :
163+ queryset = queryset [:cutoff ]
164+
163165 return OrderedDict ([
164166 (
165167 json .dumps (self .to_representation (item )),
You can’t perform that action at this time.
0 commit comments