gestioCOF/kfet/auth/forms.py
Aurélien Delobelle 82582866b4 Clean forms/views/urls related to kfetauth.Group…
…and it becomes possible to add extra forms/formsets to the create and
update group views.
2017-10-17 16:50:39 +02:00

28 lines
772 B
Python

from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from utils.forms import KeepUnselectableModelFormMixin
from .fields import GroupsField, CorePermissionsField
from .models import Group
class GroupForm(KeepUnselectableModelFormMixin, forms.ModelForm):
permissions = CorePermissionsField(label='', required=False)
keep_unselectable_fields = ['permissions']
class Meta:
model = Group
fields = ['name', 'permissions']
class UserGroupForm(KeepUnselectableModelFormMixin, forms.ModelForm):
groups = GroupsField(label=_("Statut équipe"), required=False)
keep_unselectable_fields = ['groups']
class Meta:
model = User
fields = ['groups']