kpsul/kfet/auth/forms.py
Ludovic Stephan d3185f25c3 Black
2020-09-07 14:57:41 +02:00

30 lines
677 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"]