Commit 2307180f authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

fix migration 0017: set date_joined when setting default group

parent 5da4612a
......@@ -52,7 +52,7 @@ class Migration(DataMigration):
map(_create_astakogroup, t)
orphans = orm.AstakosUser.objects.annotate(num_groups=Count('astakos_groups')).filter(num_groups = 0)
map ( lambda u: orm.Membership(group=groups['default'], person=u).save(), orphans )
map ( lambda u: orm.Membership(group=groups['default'], person=u, date_joined=datetime.datetime.now()).save(), orphans )
def backwards(self, orm):
def _delete_groupkind(name):
......
......@@ -563,16 +563,6 @@ def superuser_post_syncdb(sender, **kwargs):
post_syncdb.connect(superuser_post_syncdb)
def set_default_group(sender, **kwargs):
try:
default = AstakosGroup.objects.get(name='default')
orphans = AstakosUser.objects.annotate(num_groups=Count('astakos_groups')).filter(num_groups = 0)
map ( lambda u: Membership(group=default, person=u).save(), orphans )
except AstakosGroup.DoesNotExist:
pass
post_migrate.connect(set_default_group)
def superuser_post_save(sender, instance, **kwargs):
if instance.is_superuser:
create_astakos_user(instance)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment