Commit d5e95047 authored by RJC's avatar RJC

added forumpostcreateview to views.py in forum module

parent a56e5be7
from django.shortcuts import render from django.shortcuts import render
from django.views import generic from django.views import generic
from django.urls import reverse
from .models import ForumPost from .models import ForumPost
import pytz import pytz
from django.utils import timezone from django.utils import timezone
...@@ -26,3 +27,13 @@ class ForumPostDetailView(generic.DetailView): ...@@ -26,3 +27,13 @@ class ForumPostDetailView(generic.DetailView):
template_name = 'forum/forumpost-details.html' template_name = 'forum/forumpost-details.html'
queryset = ForumPost.objects.all() queryset = ForumPost.objects.all()
context_object_name = 'posts' context_object_name = 'posts'
class ForumPostCreateView(generic.CreateView):
model = ForumPost
template_name = 'forum/forumpost-add.html'
fields = '__all__'
def get_success_url(self):
return reverse('forum:forumpostdetailview', kwargs={ 'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment