Use convenience imports

This commit is contained in:
Aurélien Delobelle 2017-10-12 13:42:06 +02:00
parent c17ed416c4
commit e6fab703ee

View file

@ -1,5 +1,4 @@
from django import forms
from django.forms import widgets
from .models import Group, Permission
@ -7,13 +6,13 @@ from .models import Group, Permission
class GroupsField(forms.ModelMultipleChoiceField):
def __init__(self, **kwargs):
kwargs.setdefault('queryset', Group.objects.all())
kwargs.setdefault('widget', widgets.CheckboxSelectMultiple)
kwargs.setdefault('widget', forms.CheckboxSelectMultiple)
super().__init__(**kwargs)
class BasePermissionsField(forms.ModelMultipleChoiceField):
def __init__(self, **kwargs):
kwargs.setdefault('widget', widgets.CheckboxSelectMultiple)
kwargs.setdefault('widget', forms.CheckboxSelectMultiple)
super().__init__(**kwargs)
def label_from_instance(self, obj):