File location of templates have been fixed

parent 295a2ac1
{% extends 'base.html' %}
{% load static %}
<title>{% block title %}Widget's Forum{% endblock %}</title>
{% block styles %}
<style>
body {
background-color: rgb(253, 222, 207);
font-family: Georgia, serif;
font-size: 16px;
color: rgb(206, 132, 100);
}
</style>
{% endblock %}
{% block content %}
<div style="text-align: center;">
<h1>Welcome to Widget's Forum</h1>
</div>
<p1>Forum posts:</p1>
{% for post in posts %}
<li><a href="{% url 'Forum:forumpost-details' pk=post.pk %}">{{ post.title }} by {{ post.author }}</a></li>
{% endfor %}
<br>
<button type="submit">
<a href="{% url 'Forum:forumpost-add' %}">New Post</a>
</button>
<br>
<br>
<a href="http://127.0.0.1:8000/Dashboard/dashboard">Dashboard</a>
<br>
<a href="http://127.0.0.1:8000/Announcements/announcements">Announcements</a>
<br>
<a href="http://127.0.0.1:8000/Assignments/assignments">Assignments</a>
<br>
<a href="http://127.0.0.1:8000/widgetcalendar/calendar">Calendar</a>
{% endblock %}
\ No newline at end of file
...@@ -23,17 +23,17 @@ def index(request): ...@@ -23,17 +23,17 @@ def index(request):
def forum(request): def forum(request):
posts = ForumPost.objects.all() posts = ForumPost.objects.all()
context = {'posts': posts} context = {'posts': posts}
return render(request, 'forum.html', context) return render(request, 'forum/forum.html', context)
class ForumListView(ListView): class ForumListView(ListView):
model = ForumPost model = ForumPost
template_name = 'forum.html' template_name = 'forum/forum.html'
context_object_name = 'posts' context_object_name = 'posts'
ordering = ['-pub_datetime'] # sort by newest to oldest ordering = ['-pub_datetime'] # sort by newest to oldest
class ForumDetailView(DetailView): class ForumDetailView(DetailView):
model = ForumPost model = ForumPost
template_name = 'forumpost-details.html' template_name = 'forum/forumpost-details.html'
context_object_name = 'post' context_object_name = 'post'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
...@@ -44,9 +44,9 @@ class ForumDetailView(DetailView): ...@@ -44,9 +44,9 @@ class ForumDetailView(DetailView):
class AddForumPostView(CreateView): class AddForumPostView(CreateView):
model = ForumPost model = ForumPost
fields = ['title', 'body', 'author'] fields = ['title', 'body', 'author']
template_name = 'forumpost-add.html' template_name = 'forum/forumpost-add.html'
class EditForumPostView(UpdateView): class EditForumPostView(UpdateView):
model = ForumPost model = ForumPost
fields = ['title', 'body', 'author'] fields = ['title', 'body', 'author']
template_name = 'forumpost-edit.html' template_name = 'forum/forumpost-edit.html'
\ No newline at end of file \ No newline at end of file
No preview for this file type
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