I am using select2 for my dropdowns. I have dropdown that has some 18000 entries , so I want to use HeavySelect2Widget for it. I getting an error
Reverse of 'django_select2_central_json' with arguments () and keyword arguments '{}' not found
Any idea what's the problem.The class and field name used is given below
class EmployeeChoices(AutoModelSelect2Field):
fname = FirstName()
queryset = [(1,'value 1')]#fname.getAllNames()
search_fields = ['name__icontains',]
field_name = EmployeeChoices(
required=False,
widget=AutoHeavySelect2Widget(
select2_options={
'placeholder': u"Select a choice"
}
),
label=''
)
You have to include the django_select2 urls in your urls.py
:
from django.conf.urls import patterns, url, include
urlpatterns = patterns('',
url(...),
url(r'^someurlprefix/', include('django_select2.urls')),
url(...),
)
r'^someprefix/'
is a regex expression, and the url_patterns uses this regex expression to map urls to view functions. If you specify the prefix here (it can even be r''
, that's what I personally use), Django's reverse
function will automatically provide the right url to get to the django_select2_central_json
view.
Also check out the documentation on Django's url dispatcher.
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