preparing stuff for gen get_field_selection()

This commit is contained in:
Matthias 2021-05-18 10:48:29 +02:00
parent 64f8846e99
commit db9fd28276

View File

@ -783,15 +783,6 @@ class PartImport(FileManagementFormView):
def get_field_selection(self): def get_field_selection(self):
""" Fill the form fields for step 3 """ """ Fill the form fields for step 3 """
self.file_manager.setup()
# collect reference indexes
idx_s = {}
for col in self.file_manager.HEADERS:
index = self.get_column_index(col)
if index >= 0:
idx_s[col] = index
# fetch available elements # fetch available elements
self.allowed_items = {} self.allowed_items = {}
self.matches = {} self.matches = {}
@ -803,6 +794,15 @@ class PartImport(FileManagementFormView):
self.allowed_items['default_supplier'] = SupplierPart.objects.all() self.allowed_items['default_supplier'] = SupplierPart.objects.all()
self.matches['default_supplier'] = ['SKU__contains'] self.matches['default_supplier'] = ['SKU__contains']
# setup
self.file_manager.setup()
# collect reference indexes
idx_s = {}
for col in self.file_manager.HEADERS:
index = self.get_column_index(col)
if index >= 0:
idx_s[col] = index
for row in self.rows: for row in self.rows:
for idx in idx_s: for idx in idx_s:
data = row['data'][idx_s[idx]]['cell'] data = row['data'][idx_s[idx]]['cell']