Commit 261d274c authored by Eugene Ezekiel P. Tan's avatar Eugene Ezekiel P. Tan

added CBV for Forum

parent adfc2aac
from django.urls import path
from .views import MainForumPage
from . import views
app_name = "Forum"
urlpatterns = [
#forum home page
path('', views.index, name='index'),
path('', MainForumPage.as_view(), name='index'),
#forum posts
path("<int:post_id>/details/", views.posts, name='post'),
#making new forum posts
path("posts/add/", views.newPost,name= 'addPost')
path("posts/add/", views.newPost,name='addPost')
]
from django.http import HttpResponse
from django.views import View
import Forum
from .forms import PostForm
from . models import Post, Reply
from homepage.models import WidgetUser
from django.shortcuts import render, redirect
def index(request):
class MainForumPage(View):
def get(self, request):
Posts = Post.objects.all()
Replies = Reply.objects.all()
post_list = Post.objects.order_by("-pub_date")
......
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