forked from DGNum/gestioCOF
Use convenience imports
This commit is contained in:
parent
2d36c85085
commit
007b5006d4
1 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.forms import widgets
|
|
||||||
|
|
||||||
from .models import KFetPermission
|
from .models import KFetPermission
|
||||||
|
|
||||||
|
@ -8,7 +7,7 @@ from .models import KFetPermission
|
||||||
class KFetPermissionsField(forms.ModelMultipleChoiceField):
|
class KFetPermissionsField(forms.ModelMultipleChoiceField):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs.setdefault("queryset", KFetPermission.objects.all())
|
kwargs.setdefault("queryset", KFetPermission.objects.all())
|
||||||
kwargs.setdefault("widget", widgets.CheckboxSelectMultiple)
|
kwargs.setdefault("widget", forms.CheckboxSelectMultiple)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def label_from_instance(self, obj):
|
def label_from_instance(self, obj):
|
||||||
|
@ -18,7 +17,7 @@ class KFetPermissionsField(forms.ModelMultipleChoiceField):
|
||||||
class KFetGroupsField(forms.ModelMultipleChoiceField):
|
class KFetGroupsField(forms.ModelMultipleChoiceField):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs.setdefault("queryset", Group.objects.filter(kfetgroup__isnull=False))
|
kwargs.setdefault("queryset", Group.objects.filter(kfetgroup__isnull=False))
|
||||||
kwargs.setdefault("widget", widgets.SelectMultiple)
|
kwargs.setdefault("widget", forms.SelectMultiple)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def label_from_instance(self, obj):
|
def label_from_instance(self, obj):
|
||||||
|
|
Loading…
Reference in a new issue