diff options
Diffstat (limited to 'django/engagementmanager/rest/data_loader.py')
-rw-r--r-- | django/engagementmanager/rest/data_loader.py | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/django/engagementmanager/rest/data_loader.py b/django/engagementmanager/rest/data_loader.py index 11e8dfc..7ee7e70 100644 --- a/django/engagementmanager/rest/data_loader.py +++ b/django/engagementmanager/rest/data_loader.py @@ -1,5 +1,5 @@ -# -# ============LICENSE_START========================================== +# +# ============LICENSE_START========================================== # org.onap.vvp/engagementmgr # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -36,7 +36,6 @@ # ============LICENSE_END============================================ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. -import json from uuid import uuid4 from django.utils import timezone @@ -56,17 +55,27 @@ class EngLeadsDataLoader(VvpApiView): def get(self, request): data = request.data - service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name) + service_provider_company = Vendor.objects.get( + name=Constants.service_provider_company_name) el_role = Role.objects.get(name="el") for el in data: user_object = CustomUser.objects.create_user( - username=el['full_name'], email=el['full_name'], password=el['password'], is_active=False, activation_token=uuid4(), activation_token_create_time=timezone.now()) - data = createUserTemplate(service_provider_company, el['full_name'], el_role, '', True, None, True, user_object) - el_user, is_profile_created = IceUserProfile.objects.update_or_create( - email=user_object.email, defaults=data) + username=el['full_name'], email=el['full_name'], + password=el['password'], is_active=False, + activation_token=uuid4(), + activation_token_create_time=timezone.now()) + data = createUserTemplate( + service_provider_company, el['full_name'], el_role, '', + True, None, True, user_object) + el_user, is_profile_created = \ + IceUserProfile.objects.update_or_create( + email=user_object.email, defaults=data) self.logger.info("User: " + el_user.full_name + - " was created successfully during bulk_load_engagement_leads function") - self.logger.info("All users were created successfully during bulk_load_engagement_leads function") + " was created successfully during \ + bulk_load_engagement_leads function") + self.logger.info( + "All users were created successfully during \ + bulk_load_engagement_leads function") return Response() @@ -76,7 +85,12 @@ class CompaniesDataLoader(VvpApiView): def get(self, request): data = request.data for vendor in data: - Vendor.objects.get_or_create(name=vendor['name'], defaults={'public': True}) - self.logger.info('Company found or created during bulk load vendors: ' + logEncoding(vendor)) - self.logger.info("All companies were created successfully during bulk_load_companies function") + Vendor.objects.get_or_create( + name=vendor['name'], defaults={'public': True}) + self.logger.info( + 'Company found or created during bulk load vendors: ' + + logEncoding(vendor)) + self.logger.info( + "All companies were created successfully during \ + bulk_load_companies function") return Response() |