<commit_before>import collections

from django import forms
from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
from django.utils.translation import ngettext

from adhocracy4.projects.models import Project
from meinberlin.apps.plans.models import Plan
from meinberlin.apps.users.models import User

from . import models


class OrganisationForm(forms.ModelForm):

    class Meta:
        model = models.Organisation
        fields = '__all__'

    def clean(self):
        groups = self.cleaned_data.get('groups')
        duplicates = self._check_user_twice(groups)
        if duplicates:<commit_msg>Group widget: changing default widget for group selection for orgs to be more userfriendly<commit_after>import collections

from django import forms
from django.contrib.admin import widgets
from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
from django.utils.translation import ngettext
from django.utils.translation import ugettext_lazy as _

from adhocracy4.projects.models import Project
from meinberlin.apps.plans.models import Plan
from meinberlin.apps.users.models import User

from . import models


class OrganisationForm(forms.ModelForm):

    class Meta:
        model = models.Organisation
        fields = '__all__'
        widgets = {
            'groups': widgets.FilteredSelectMultiple(_('Groups'), False),
        }

    def clean(self):
        groups = self.cleaned_data.get('groups')
        duplicates = self._check_user_twice(groups)
        if duplicates:
{'fraction_non_alphanumeric': 0.06896551724137931, 'fraction_numerical': 0.001277139208173691, 'mean_word_length': 3.8664596273291925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5435527', 'n_tokens_mistral': 434, 'n_tokens_neox': 416, 'n_words': 123}