- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 88
 
Open
Description
Trying to import 10Mb  CSV file but getting no response.
But able to import with 500 records
About CSV file
Total no of records= 157797
No of columns = 8
Updated the settings.py as below
FILE_UPLOAD_MAX_MEMORY_SIZE = 15728640
DATA_UPLOAD_MAX_MEMORY_SIZE = 15728640
And the view defined as
class ImportParts(APIView):
   def post(self, request):
    if request.method == "POST":
        form = UploadFileForm(request.POST,
                              request.FILES)
        def choice_func(row):
            q = Parts.objects.filter(cno=row[1], sNo=row[2])
            if q:
                dictionary = dict(zip(model_dict, row))
                q.update(**dictionary)
                row = []
            return row
        if form.is_valid():
            request.FILES['file'].save_to_database(
                model=Parts,
                initializer=choice_func,
                mapdict=(
                    model_dict
                )
            )
            return JsonResponse({"success": True}, status=status.HTTP_201_CREATED)
        else:
            return HttpResponseBadRequest()
    return HttpResponseBadRequest()`
Metadata
Metadata
Assignees
Labels
No labels