Use convenience imports
This commit is contained in:
parent
c17ed416c4
commit
e6fab703ee
1 changed files with 2 additions and 3 deletions
|
@ -1,5 +1,4 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms import widgets
|
|
||||||
|
|
||||||
from .models import Group, Permission
|
from .models import Group, Permission
|
||||||
|
|
||||||
|
@ -7,13 +6,13 @@ from .models import Group, Permission
|
||||||
class GroupsField(forms.ModelMultipleChoiceField):
|
class GroupsField(forms.ModelMultipleChoiceField):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
kwargs.setdefault('queryset', Group.objects.all())
|
kwargs.setdefault('queryset', Group.objects.all())
|
||||||
kwargs.setdefault('widget', widgets.CheckboxSelectMultiple)
|
kwargs.setdefault('widget', forms.CheckboxSelectMultiple)
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
class BasePermissionsField(forms.ModelMultipleChoiceField):
|
class BasePermissionsField(forms.ModelMultipleChoiceField):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
kwargs.setdefault('widget', widgets.CheckboxSelectMultiple)
|
kwargs.setdefault('widget', forms.CheckboxSelectMultiple)
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def label_from_instance(self, obj):
|
def label_from_instance(self, obj):
|
||||||
|
|
Loading…
Reference in a new issue