Saving records into mysql table

I developed a simple application that saves a single field into MySQL table. Whenever I click at the 'save' button, I use to see the attribute error message below. 

AttributeError at /namev/

'NameForm' object has no attribute 'save'
Request Method: POST
Request URL: http://localhost:8000/namev/
Django Version: 2.1.5
Exception Type: AttributeError
Exception Value:
'NameForm' object has no attribute 'save'
Exception Location: C:\Users\IFEANYI CHIELO\divinecrownapp\pages\ in Namev_view, line 17
Python Executable: C:\Users\IFEANYI CHIELO\AppData\Local\Programs\Python\Python37\python.exe
Python Version: 3.7.2
Python Path:
['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
 'C:\\Users\\IFEANYI '
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\IFEANYI '
Server time: Sun, 5 Apr 2020 19:46:34 +0000


Code for file 

ef Namev_view (request):

    if request.method == 'POST':

        form = NameForm(request.POST)

        if form.is_valid():


            return HttpResponseRedirect('/namev/')


        form = NameForm()

    return render(request, 'namev.html', {'form': form})

Django Replies 1 Views 43 Users 1

Suggested Topics

Django Updated on April 1, 2020, 9:12 p.m. Replies Views 55

Django Updated on April 7, 2020, 9:54 p.m. Replies Views 73

Django Updated on April 13, 2020, 11:35 a.m. Replies Views 143