'is_active': True, 'is_superuser': False, 'password': password } user = User(**user_defaults) if user: user.save() # Get/Create the user profile try: profile = user.get_profile() except: profile = Profile(git_access_token=token, user=user, meta=resp.content) # update meta information and token profile.git_access_token = token profile.meta = resp.content profile.save() # Create settings for user try: user_settings = Setting.objects.get(user=user) except: user_settings = None if not user_settings: s = Setting()