From b25ad2de8e32baee08354ac197b10f0e1b958d48 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 24 Feb 2018 18:26:21 -0800 Subject: [PATCH] sigh was looking up users based on username to check for need to rename. --- ttadmin/users/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ttadmin/users/models.py b/ttadmin/users/models.py index 52a5a08..51af53c 100644 --- a/ttadmin/users/models.py +++ b/ttadmin/users/models.py @@ -192,16 +192,15 @@ def on_pubkey_post_save(sender, instance, **kwargs): @receiver(pre_save, sender=Townie) def on_townie_pre_save(sender, instance, **kwargs): - existing = Townie.objects.filter(username=instance.username) - if not existing: - # we're making a new Townie; this means someone just signed up. We - # don't care at all about their state on disk. + if instance.id is None: + logging.info('Signup from {}'.format(instance.username)) return - existing = existing[0] + existing = Townie.objects.get(id=instance.id) # See if we need to create this user on disk. if not existing.reviewed and instance.reviewed is True: + logging.info('Creating user {} on disk.'.format(instance.username)) instance.create_on_disk() instance.send_welcome_email() instance.write_authorized_keys()