@@ -60,31 +60,31 @@ You can use this as custom widget for `ManyToManyField`.
60
60
# ...
61
61
)
62
62
` ` `
63
-
63
+
64
64
4. Use the widget in your model admin class:
65
65
66
66
` ` ` python
67
67
from django import models, forms
68
68
from searchableselect.widgets import SearchableSelect
69
69
from models import Traveler
70
-
70
+
71
71
class TravelerForm(forms.ModelForm):
72
72
class Meta:
73
73
model = Traveler
74
74
exclude = ()
75
75
widgets = {
76
76
' cities_visited' : SearchableSelect(model=' cities.City' , search_field=' name' , many=True, limit=10)
77
77
}
78
-
79
-
78
+
79
+
80
80
class TravelerAdmin(admin.ModelAdmin):
81
81
form = TravelerForm
82
-
82
+
83
83
admin.site.register(Traveler, TravelerAdmin)
84
84
` ` `
85
85
86
86
Remember to ** always** initialize ` SearchableSelect` with three keyword arguments: ` model` , ` search_field` and ` many` .
87
-
87
+
88
88
- ` model` is the string in form ` APP_NAME.MODEL_NAME` representing your model in the project, e. g. ' cities.City'
89
89
- ` search_field` is the field within model that will be used to perform filtering, e. g. ' name'
90
90
- ` many` must be ` True` for ` ManyToManyField` and ` False` for ` ForeignKey` .
@@ -97,7 +97,7 @@ Just run the project from `example` directory, head to http://127.0.0.1:8000, lo
97
97
# Supported versions
98
98
99
99
- Python 2.7.x: Django 1.7, 1.8, 1.9, 1.10
100
- - Python 3.x: Django 1.8, 1.9, 1.10
100
+ - Python 3.x: Django 1.8, 1.9, 1.10, 2.0
101
101
102
102
# Testing
103
103
@@ -119,7 +119,7 @@ coverage erase
119
119
# This command can be ran multiple times.
120
120
tox -e < python_ver> -< django_ver>
121
121
# Possible python_ver values: `py27`, `py36`
122
- # Possible django_ver values: `17`, `18`, `19`, `110`
122
+ # Possible django_ver values: `17`, `18`, `19`, `110`, '20'
123
123
# Values can be comma-seperated, e. g. `-e py27-17,py27-18,py36-18`
124
124
# If you omit `-e ...` parameter, all environments will be tests.
125
125
# Also - not problems with running this within a virtualenv.
0 commit comments