mirror of
https://github.com/Hopiu/django-select2.git
synced 2026-04-28 00:44:44 +00:00
Lots of fixes and redesign. Also added a full fledged project for testing out the components.
17 lines
No EOL
388 B
Python
17 lines
No EOL
388 B
Python
from django import forms
|
|
|
|
from django_select2 import *
|
|
|
|
from .models import Employee, Dept
|
|
|
|
class EmployeeChoices(AutoModelSelect2Field):
|
|
queryset = Employee.objects
|
|
search_fields = ['name__icontains', ]
|
|
|
|
class EmployeeForm(forms.ModelForm):
|
|
manager = EmployeeChoices()
|
|
dept = ModelSelect2Field(queryset=Dept.objects)
|
|
|
|
class Meta:
|
|
model = Employee
|
|
|