Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

src/g/e/Geotrek-HEAD/geotrek/authent/backend.py   Geotrek(Download)
from django.core.exceptions import ImproperlyConfigured
 
from .models import Structure, GROUP_PATH_MANAGER, GROUP_TREKKING_MANAGER, GROUP_EDITOR
 
 
    def _update_groups(self, user, credentials):
        # Set groups according to level
        editor_group, created = Group.objects.get_or_create(name=GROUP_EDITOR)
        path_manager_group, created = Group.objects.get_or_create(name=GROUP_PATH_MANAGER)
        trek_manager_group, created = Group.objects.get_or_create(name=GROUP_TREKKING_MANAGER)

src/g/e/Geotrek-HEAD/geotrek/authent/tests/test_backend.py   Geotrek(Download)
from django.contrib.auth.models import Group
 
from ..models import Structure, GROUP_PATH_MANAGER, GROUP_TREKKING_MANAGER, GROUP_EDITOR
from ..backend import DatabaseBackend
 
    def setUp(self):
        groups = (GROUP_PATH_MANAGER, GROUP_TREKKING_MANAGER, GROUP_EDITOR)
        for group in groups:
            Group.objects.get_or_create(name=group)
 
        test_level('a', 2, [GROUP_EDITOR])
        test_level('a', 3, [GROUP_PATH_MANAGER])
        test_level('a', 4, [GROUP_TREKKING_MANAGER])
        user = test_level('a', 6, [])
        self.assertTrue(user.is_staff)