Django error: TypeError at /forums/ 'str' object is not callable
I am making a Django forums project and I have run into this issue. whenever I go to my forum page I see this error: TypeError at /forums/ 'str' object is not callable. If anyone knows how to fix this I would appreciate the help.
forms:
from django import forms
from . import models
class ForumForm(forms.ModelForm):
class Meta:
model = models.Post
fields = ('message',)
models
from django.db import models
# Create your models here.
class Post(models.Model):
message = models.TextField(blank=True, null=False)
created_at = models.DateTimeField(auto_now=True)
URLs
from django.contrib import admin
from django.urls import path, include
from . import views
app_name = 'forums'
urlpatterns = [
path('', views.ForumForm.as_view(), name='forum')
]
views
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views import generic
from . import forms
# Create your views here.
class ForumForm(generic.CreateView):
template_name = 'forums_simple/forum.html'
form_class = 'ForumForm'
success_url = '/'
def form_vaild(self, form):
self.object = form.save(commit=False)
self.object.save()
return super().form_vaild(form)
Change form_class = 'ForumForm'
to form_class = forms.ForumForm
.