Error in Django Module

2

Whenever I try to run, I'm getting the following error described below. I've already researched a solution, but I can not get it to work.

  

Exception Type: ValueError       Exception Value:
      ModelForm has no model class specified.       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

views.py

@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
    
asked by anonymous 16.05.2016 / 15:31

2 answers

0

@TheuzC,

Your meta is actually Meta .

Try this out there:

class ProfessorForm(forms.ModelForm):

    class Meta:
        model = Professor
    
16.05.2016 / 17:39
0

True, I got it this way

class Meta:
    model = Professor
    fields = '__all__'      << Django estava pedido

and models had a statement for the wrong bank, so when it was going to access it it did not exist and it gave error by not finding

    
18.05.2016 / 16:23