I am new to Django and was working with Django forms and stuck at an error for which I am not finding any relevant solution.
My Form.py is :
from django import forms
class MyForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
text = forms.CharField(widget=forms.Textarea)
and My views.py is :
from django.shortcuts import render
from django.http import HttpResponse
from . import forms
# Create your views here.
def index(request):
return render(request, 'basicapp/index.html')
def forms(request):
form = forms.MyForm()
return render(request, 'basicapp/forms.html', context = { 'form' : form
})
All the routing is Fine as I have checked by replacing forms with a normal HttpResponse but there is some problem in the forms.py or views.py as they the form in not being displayed in the browser and the Error is coming
'function' object has no attribute 'MyForm'
Please Someone help :( I gotta move Forward