gestioCOF/kfet/auth/forms.py
2020-09-07 14:57:41 +02:00

27 lines
655 B
Python

from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from shared.forms import ProtectedModelForm
from .fields import KFetGroupsField, KFetPermissionsField
from .models import KFetGroup
class GroupForm(ProtectedModelForm):
permissions = KFetPermissionsField()
protected_fields = ["permissions"]
class Meta:
model = KFetGroup
fields = ["name", "permissions"]
class UserGroupForm(ProtectedModelForm):
groups = KFetGroupsField(label=_("Statut équipe"), required=False,)
protected_fields = ["groups"]
class Meta:
model = User
fields = ["groups"]