From 7e0f2d0823ce675aae976a6a69ba512a6212d2c9 Mon Sep 17 00:00:00 2001 From: Baptiste Beauplat Date: Sun, 29 Aug 2021 11:35:20 +0200 Subject: [PATCH] Remove Profile validation code in create_user command (Profile validation can't fail) --- debexpo/accounts/management/commands/create_user.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/debexpo/accounts/management/commands/create_user.py b/debexpo/accounts/management/commands/create_user.py index fe64e24a..e5b31693 100644 --- a/debexpo/accounts/management/commands/create_user.py +++ b/debexpo/accounts/management/commands/create_user.py @@ -61,11 +61,6 @@ class Command(BaseCommand): except ValidationError as e: raise CommandError(f'Failed to create a new user: {str(e)}') - new_profile = None - try: - new_profile = Profile(user=new_user) - new_profile.full_clean() - except ValidationError as e: - raise CommandError(f'Failed to create a new user profile: {str(e)}') - else: - new_profile.save() + new_profile = Profile(user=new_user) + + new_profile.save() -- GitLab