I'm trying to run a form in django but it returns this error
form = TopicoForm()
raise ValueError('ModelForm has no model class specified.')
this is my models
class Topico(models.Model):
titulo = models.CharField('Título', max_length=100)
mensagem = models.TextField('Mensagem')
avatar = models.ImageField(upload_to='core/images', verbose_name='Imagem', blank=True, null=True)
id_usuario = models.ForeignKey(Usuario)
id_assunto = models.ForeignKey(Assunto)
def __str__(self):
return self.titulo
o form
class TopicoForm(forms.ModelForm):
class meta:
model = Topico
fields = '__all__'
and a views
def novo_post(request):
if request.POST:
form = TopicoForm(request.POST)
if form.is_valid:
form.save()
else:
form = TopicoForm()
contexto = {
"form": form
}
return render(request, "novo_post.html", contexto)