def createUser(self, is_super, username, email, password): try: User.objects.get(username=username) self.stdout.write( "\nERROR:The user %s already exists, choose another username.\n\n" % username) return except User.DoesNotExist: pass user = None if is_super: self.stdout.write("\nCreated super user %s.\n\n" % username) user = User.objects.create_superuser(username, email, password) else: self.stdout.write("\nCreated normal user %s.\n\n" % username) user = User.objects.create_user(username, email, password) pf = EmifProfile(user=user) pf.save() add_invited(user)
def custom_update_user(sender, attributes, user_modified, **kwargs): try: pf = sender.emif_profile except EmifProfile.DoesNotExist: pf = EmifProfile(user=sender) pf.save() add_invited(sender) print "AFTER ADD INVITED" if user_modified: return True # I modified the user object
def createUser(self, is_super, username, email, password): try: User.objects.get(username=username) self.stdout.write("\nERROR:The user %s already exists, choose another username.\n\n" % username) return except User.DoesNotExist: pass user = None if is_super: self.stdout.write("\nCreated super user %s.\n\n" % username) user = User.objects.create_superuser(username, email, password) else: self.stdout.write("\nCreated normal user %s.\n\n" % username) user = User.objects.create_user(username, email, password) pf = EmifProfile(user=user) pf.save() add_invited(user)