<commit_before>from __future__ import absolute_import
from __future__ import unicode_literals
import json

from django.contrib import messages
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext as _

from corehq.apps.users.models import Permissions, CommCareUser
from corehq.apps.groups.models import Group, DeleteGroupRecord
from corehq.apps.users.decorators import require_permission
from dimagi.utils.couch import CriticalSection
from dimagi.utils.couch.undo import DELETED_SUFFIX


require_can_edit_groups = require_permission(Permissions.edit_commcare_users)


@require_POST
@require_can_edit_groups
def add_group(request, domain):
    group_name = request.POST['group_name']
    if not group_name:
        messages.error(request, _(
            "We could not create the group; "
            "please give it a name first"<commit_msg>update groups submit permissions<commit_after>from __future__ import absolute_import
from __future__ import unicode_literals
import json

from django.contrib import messages
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext as _

from corehq.apps.users.models import Permissions, CommCareUser
from corehq.apps.groups.models import Group, DeleteGroupRecord
from corehq.apps.users.decorators import require_permission
from dimagi.utils.couch import CriticalSection
from dimagi.utils.couch.undo import DELETED_SUFFIX


require_can_edit_groups = require_permission(Permissions.edit_groups)


@require_POST
@require_can_edit_groups
def add_group(request, domain):
    group_name = request.POST['group_name']
    if not group_name:
        messages.error(request, _(
            "We could not create the group; "
            "please give it a name first"
{'fraction_non_alphanumeric': 0.054408060453400506, 'fraction_numerical': 0.0, 'mean_word_length': 5.365384615384615, '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': '5276452', 'n_tokens_mistral': 549, 'n_tokens_neox': 542, 'n_words': 160}