# Path: groups_manager/models.py
# def get_auth_models_sync_func_default(instance):
#     def group_model(self):
#     def group_member_model(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def full_name(self):
#     def groups(self):
#     def has_perm(self, perm, obj=None):
#     def has_perms(self, perm_list, obj=None):
#     def assign_object(self, group, obj, **kwargs):
# def member_save(sender, instance, created, *args, **kwargs):
# def member_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def member_model(self):
#     def group_member_model(self):
#     def group_members_attribute(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def _get_full_name(self):
#     def subgroups(self):
#     def get_members(self, subgroups=False):
#     def members(self):
#     def users(self):
#     def get_entities(self, subgroups=False):
#     def entities(self):
#     def add_member(self, member, roles=None, expiration_date=None):
#     def remove_member(self, member):
#     def assign_object(self, obj, **kwargs):
# def group_save(sender, instance, created, *args, **kwargs):
# def group_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def assign_object(self, obj, **kwargs):
# def group_member_save(sender, instance, created, *args, **kwargs):
# def group_member_delete(sender, instance, *args, **kwargs):
# class MemberRelationsMixin(object):
#     class GroupsManagerMeta:
# class MemberMixin(MemberRelationsMixin, models.Model):
#     class Meta:
# class Member(MemberMixin):
#     class Meta(MemberMixin.Meta):
# class GroupTypeMixin(models.Model):
#     class Meta:
# class GroupType(GroupTypeMixin):
#     class Meta(GroupTypeMixin.Meta):
# class GroupEntityMixin(models.Model):
#     class Meta:
# class GroupEntity(GroupEntityMixin):
#     class Meta(GroupEntityMixin.Meta):
# class GroupRelationsMixin(object):
#     class GroupsManagerMeta:
# class GroupMixin(GroupRelationsMixin, MPTTModel):
#     class Meta:
#     class MPTTMeta:
#     class GroupsManagerMeta(GroupRelationsMixin.GroupsManagerMeta):
# class Group(GroupMixin):
#     class Meta(GroupMixin.Meta):
# class GroupMemberRoleMixin(models.Model):
#     class Meta:
# class GroupMemberRole(GroupMemberRoleMixin):
#     class Meta(GroupMemberRoleMixin.Meta):
# class GroupMemberMixin(models.Model):
#     class Meta:
# class GroupMember(GroupMemberMixin):
#     class Meta(GroupMemberMixin.Meta):


from django.db import models
from django.db.models.signals import post_save, post_delete
from mptt.models import TreeManager
from groups_manager.models import Group, Member, GroupType, GroupMember, \
    GroupMixin, MemberMixin, GroupMemberMixin, GroupMemberRoleMixin, GroupEntityMixin, GroupTypeMixin, \
    group_save, group_delete, member_save, member_delete, group_member_save, group_member_delete, \
    DjangoUser, DjangoGroup
                                   related_name='%(app_label)s_%(class)s_set')
    group_entities = models.ManyToManyField(OrganizationEntityWithMixin, blank=True,
                                            related_name='%(app_label)s_%(class)s_set')

    django_group = models.ForeignKey(DjangoGroup, null=True, blank=True, on_delete=models.SET_NULL)
    group_members = models.ManyToManyField('OrganizationMemberWithMixin', through=OrganizationGroupMemberWithMixin,
                                           through_fields=('group', 'member'),
                                           related_name='%(app_label)s_%(class)s_set')

    class GroupsManagerMeta:
        member_model = 'testproject.OrganizationMemberWithMixin'
        group_member_model = 'testproject.OrganizationGroupMemberWithMixin'

    def save(self, *args, **kwargs):
        if not self.short_name:
            self.short_name = self.name
        super(OrganizationGroupWithMixin, self).save(*args, **kwargs)

    @property
    def members_names(self):
        return [member.full_name for member in self.group_members.all()]


post_save.connect(group_save, sender=OrganizationGroupWithMixin)
post_delete.connect(group_delete, sender=OrganizationGroupWithMixin)


class OrganizationMemberWithMixin(MemberMixin):
    last_edit_date = models.DateTimeField(auto_now=True, null=True)


# Path: groups_manager/models.py
# def get_auth_models_sync_func_default(instance):
#     def group_model(self):
#     def group_member_model(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def full_name(self):
#     def groups(self):
#     def has_perm(self, perm, obj=None):
#     def has_perms(self, perm_list, obj=None):
#     def assign_object(self, group, obj, **kwargs):
# def member_save(sender, instance, created, *args, **kwargs):
# def member_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def member_model(self):
#     def group_member_model(self):
#     def group_members_attribute(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def _get_full_name(self):
#     def subgroups(self):
#     def get_members(self, subgroups=False):
#     def members(self):
#     def users(self):
#     def get_entities(self, subgroups=False):
#     def entities(self):
#     def add_member(self, member, roles=None, expiration_date=None):
#     def remove_member(self, member):
#     def assign_object(self, obj, **kwargs):
# def group_save(sender, instance, created, *args, **kwargs):
# def group_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def assign_object(self, obj, **kwargs):
# def group_member_save(sender, instance, created, *args, **kwargs):
# def group_member_delete(sender, instance, *args, **kwargs):
# class MemberRelationsMixin(object):
#     class GroupsManagerMeta:
# class MemberMixin(MemberRelationsMixin, models.Model):
#     class Meta:
# class Member(MemberMixin):
#     class Meta(MemberMixin.Meta):
# class GroupTypeMixin(models.Model):
#     class Meta:
# class GroupType(GroupTypeMixin):
#     class Meta(GroupTypeMixin.Meta):
# class GroupEntityMixin(models.Model):
#     class Meta:
# class GroupEntity(GroupEntityMixin):
#     class Meta(GroupEntityMixin.Meta):
# class GroupRelationsMixin(object):
#     class GroupsManagerMeta:
# class GroupMixin(GroupRelationsMixin, MPTTModel):
#     class Meta:
#     class MPTTMeta:
#     class GroupsManagerMeta(GroupRelationsMixin.GroupsManagerMeta):
# class Group(GroupMixin):
#     class Meta(GroupMixin.Meta):
# class GroupMemberRoleMixin(models.Model):
#     class Meta:
# class GroupMemberRole(GroupMemberRoleMixin):
#     class Meta(GroupMemberRoleMixin.Meta):
# class GroupMemberMixin(models.Model):
#     class Meta:
# class GroupMember(GroupMemberMixin):
#     class Meta(GroupMemberMixin.Meta):


# Path: testproject/testproject/models.py
from django.db import models
from django.db.models.signals import post_save, post_delete
from mptt.models import TreeManager
from groups_manager.models import Group, Member, GroupType, GroupMember, \
    GroupMixin, MemberMixin, GroupMemberMixin, GroupMemberRoleMixin, GroupEntityMixin, GroupTypeMixin, \
    group_save, group_delete, member_save, member_delete, group_member_save, group_member_delete, \
    DjangoUser, DjangoGroup

                                   related_name='%(app_label)s_%(class)s_set')
    group_entities = models.ManyToManyField(OrganizationEntityWithMixin, blank=True,
                                            related_name='%(app_label)s_%(class)s_set')

    django_group = models.ForeignKey(DjangoGroup, null=True, blank=True, on_delete=models.SET_NULL)
    group_members = models.ManyToManyField('OrganizationMemberWithMixin', through=OrganizationGroupMemberWithMixin,
                                           through_fields=('group', 'member'),
                                           related_name='%(app_label)s_%(class)s_set')

    class GroupsManagerMeta:
        member_model = 'testproject.OrganizationMemberWithMixin'
        group_member_model = 'testproject.OrganizationGroupMemberWithMixin'

    def save(self, *args, **kwargs):
        if not self.short_name:
            self.short_name = self.name
        super(OrganizationGroupWithMixin, self).save(*args, **kwargs)

    @property
    def members_names(self):
        return [member.full_name for member in self.group_members.all()]


post_save.connect(group_save, sender=OrganizationGroupWithMixin)
post_delete.connect(group_delete, sender=OrganizationGroupWithMixin)


class OrganizationMemberWithMixin(MemberMixin):
    last_edit_date = models.DateTimeField(auto_now=True, null=True)


    django_user = models.ForeignKey(DjangoUser, null=True, blank=True, on_delete=models.SET_NULL,