Revision 1873ca3b

b/snf-astakos-app/astakos/im/migrations/0016_populate_group_data.py
52 52
        map(_create_astakogroup, t)
53 53
        
54 54
        orphans = orm.AstakosUser.objects.annotate(num_groups=Count('astakos_groups')).filter(num_groups = 0)
55
        map ( lambda u: orm.Membership(group=groups['default'], person=u).save(), orphans )
55
        map ( lambda u: orm.Membership(group=groups['default'], person=u, date_joined=datetime.datetime.now()).save(), orphans )
56 56
        
57 57
    def backwards(self, orm):
58 58
        def _delete_groupkind(name):
b/snf-astakos-app/astakos/im/models.py
563 563

  
564 564
post_syncdb.connect(superuser_post_syncdb)
565 565

  
566
def set_default_group(sender, **kwargs):
567
    try:
568
        default = AstakosGroup.objects.get(name='default')
569
        orphans = AstakosUser.objects.annotate(num_groups=Count('astakos_groups')).filter(num_groups = 0)
570
        map ( lambda u: Membership(group=default, person=u).save(), orphans )
571
    except AstakosGroup.DoesNotExist:
572
        pass
573
    
574
post_migrate.connect(set_default_group)
575

  
576 566
def superuser_post_save(sender, instance, **kwargs):
577 567
    if instance.is_superuser:
578 568
        create_astakos_user(instance)

Also available in: Unified diff