2
Whenever I try to run, I’m getting the following error described below. I’ve already searched a solution, but I can’t make it work.
Exception Type: Valueerror Exception Value:
Models in the specified class model. Exception Location: /usr/local/lib/python2.7/dist-Packages/Django/Forms/models.py in init, line 275 Python Executable: /usr/bin/python Python Version: 2.7.6
py views.
@login_required(login_url='/login/')
def cad_professor(request):
context = {}
if request.method == 'POST':
form = ProfessorForm(request.POST)
if form.is_valid():
form.save()
context['success'] = True
else:
form = ProfessorForm()
context['form'] = form
template_name = 'envelope/cad_professor.html'
return render(request,template_name , context)
Forms.py
from django import forms
from .models import Professor
class ProfessorForm(forms.ModelForm):
class meta:
model = Professor
the code is formatted exactly like your?
– Rubico
Sorry, I fixed that yes
– TheuzC