def process_bulk_add_email_addresses(request, formdict): """ Performs the bulk add of email addreesses by parsing the request data. Batches some data into a cache object for performance by reducing large amounts of single database queries. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param formdict: The form representing the bulk uploaded data. :type formdict: dict :returns: :class:`django.http.HttpResponse` """ email_names = [] cached_results = {} cleanedRowsData = convert_handsontable_to_rows(request) for rowData in cleanedRowsData: if rowData != None and rowData.get(form_consts.EmailAddress.EMAIL_ADDRESS) != None: email_names.append(rowData.get(form_consts.EmailAddress.EMAIL_ADDRESS).lower()) email_results = EmailAddress.objects(address__in=email_names) for email_result in email_results: cached_results[email_result.address] = email_result cache = {form_consts.EmailAddress.CACHED_RESULTS: cached_results, 'cleaned_rows_data': cleanedRowsData} response = parse_bulk_upload(request, parse_row_to_bound_email_form, add_new_email_via_bulk, formdict, cache) return response
def process_bulk_add_email_addresses(request, formdict): """ Performs the bulk add of email addreesses by parsing the request data. Batches some data into a cache object for performance by reducing large amounts of single database queries. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param formdict: The form representing the bulk uploaded data. :type formdict: dict :returns: :class:`django.http.HttpResponse` """ email_names = [] cached_results = {} cleanedRowsData = convert_handsontable_to_rows(request) for rowData in cleanedRowsData: if rowData != None and rowData.get( form_consts.EmailAddress.EMAIL_ADDRESS) != None: email_names.append( rowData.get(form_consts.EmailAddress.EMAIL_ADDRESS).lower()) email_results = EmailAddress.objects(address__in=email_names) for email_result in email_results: cached_results[email_result.address] = email_result cache = { form_consts.EmailAddress.CACHED_RESULTS: cached_results, 'cleaned_rows_data': cleanedRowsData } response = parse_bulk_upload(request, parse_row_to_bound_email_form, add_new_email_via_bulk, formdict, cache) return response
def process_bulk_add_usernames(request, formdict): """ Performs the bulk add of usernames by parsing the request data. Batches some data into a cache object for performance by reducing large amounts of single database queries. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param formdict: The form representing the bulk uploaded data. :type formdict: dict :returns: :class:`django.http.HttpResponse` """ username_names = [] cached_results = {} cleanedRowsData = convert_handsontable_to_rows(request) for rowData in cleanedRowsData: if rowData != None and rowData.get(form_consts.UserName.NAME) != None: username_names.append(rowData.get(form_consts.UserName.NAME).lower()) username_results = UserName.objects(username__in=username_names) for username_result in username_results: cached_results[username_result.username] = username_result cache = {form_consts.UserName.CACHED_RESULTS: cached_results, 'cleaned_rows_data': cleanedRowsData} response = parse_bulk_upload(request, parse_row_to_bound_username_form, add_new_username_via_bulk, formdict, cache) return response
def process_bulk_add_usernames(request, formdict): """ Performs the bulk add of usernames by parsing the request data. Batches some data into a cache object for performance by reducing large amounts of single database queries. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param formdict: The form representing the bulk uploaded data. :type formdict: dict :returns: :class:`django.http.HttpResponse` """ username_names = [] cached_results = {} cleanedRowsData = convert_handsontable_to_rows(request) for rowData in cleanedRowsData: if rowData != None and rowData.get(form_consts.UserName.NAME) != None: username_names.append( rowData.get(form_consts.UserName.NAME).lower()) username_results = UserName.objects(username__in=username_names) for username_result in username_results: cached_results[username_result.username] = username_result cache = { form_consts.UserName.CACHED_RESULTS: cached_results, 'cleaned_rows_data': cleanedRowsData } response = parse_bulk_upload(request, parse_row_to_bound_username_form, add_new_username_via_bulk, formdict, cache) return response