Commit bec84554 authored by Neal Berones's avatar Neal Berones

resolved file conflicts

parents 139d83e7 272241dd
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index")
path('', views.index, name="index"),
path('welcome', views.welcome, name='welcome')
]
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from .models import Post, Reply
# Create your views here.
def welcome(request):
return HttpResponse("Welcome to Widget's forum!")
def index(request):
return HttpResponse(
"<h2>FORUM POSTS:</h2> [Title] by [Author] dated [Date]: <br> "
)
forum_view = "FORUM POSTS: "
posts = Post.objects.all()
replies = Reply.objects.all()
for post in posts:
forum_view += "<br> {} by {} {} dated {}: <br> {}".\
format(
post.post_title,
post.author.first_name,
post.author.last_name,
post.pub_date,
post.post_body
)
for reply in replies:
forum_view += '<br> Reply by {} {} dated {}: <br> {}'.\
format(
reply.author.first_name,
reply.author.last_name,
reply.pub_date,
reply.reply_body
)
return HttpResponse(forum_view)
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