while running this project  getting this error

 File
"C:\ProgramData\Anaconda3\lib\site-packages\django\urls\resolvers.py", line
347, in _check_pattern_name
    if self.pattern.name is not None and ":" in self.pattern.name:
TypeError: argument of type 'type' is not iterable


thank you

On Fri, Jun 18, 2021 at 10:52 PM ram manoj Vuyyuru <
rammanojvuyy...@gmail.com> wrote:

> Hi
> i am trying to import the csv file data into database
>  my views.py
> def Filter(request):
>     if request.method=="POST":
>         form = DataForm(request.POST, request.FILES)
>         if form.is_valid():
>             initial_obj = form.save(commit=False)
>             data=initial_obj['data']
>             path="C:\\Users\\ramma\\Downloads\\assesment.csv"
>             os.chdir(path)
>
>             with open('assesment.csv') as csvfile:
>                 reader = csv.DictReader(csvfile)
>                 for row in reader:
>                     file=data(name=row['product'],)
>
>             initial_obj.save()
>             file.save()
>             return redirect('/')
>         else:
>             return render(request,'index.html',{'form':form})
>     else:
>         return render(request,'index.html',{'form':form})
>
>
> def search(request):
>     list = data.objects.all()
>     data_filter = DataFilter(request.GET, queryset=list)
>     return render(request, 'product.html', {'filter': data_filter})
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALJzFirRGsO2hZC%3DMm6YHJRMi4CJCc9DaSFBcuD5TDxecx%3D%3DLQ%40mail.gmail.com.

Reply via email to