Commit 11952712 authored by Emilio Gentolia's avatar Emilio Gentolia

created template for new announcemnts

parent e9cc7b5e
label {
font-family: Khula;
font-weight: 600;
}
input {
font-family: Khula;
}
p {
margin: 30px 0px;
}
form {
padding-bottom: 20px;
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% load static %}
{% block title %}Homepage{% endblock %} {% block title %}Announcements{% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{% static 'announcement_board/announcement_detail.css' %}"> <link rel="stylesheet" href="{% static 'announcement_board/announcement_detail.css' %}">
......
<!-- announcements/announcement_form.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Announcements{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'announcements/announcement_form.css' %}">
{% endblock %}
{% block header %}
New Announcement
{% endblock %}
{% block content %}
<form enctype="multipart/form-data" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Announcement">
</form>
{% endblock %}
\ No newline at end of file
...@@ -26,4 +26,5 @@ Announcement Board ...@@ -26,4 +26,5 @@ Announcement Board
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a class="new-user-link" href="/announcements/add">New Announcement</a>
{% endblock %} {% endblock %}
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.views import View from django.views import View
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from .models import Announcement, Reaction from .models import Announcement, Reaction
...@@ -22,3 +23,10 @@ class AnnouncementDetailView(DetailView): ...@@ -22,3 +23,10 @@ class AnnouncementDetailView(DetailView):
return context return context
class AnnouncementCreateView(CreateView):
model = Announcement
fields = ["announcement_title", "announcement_body", "author", "announcement_pic"]
def get_success_url(self):
return "/announcements/"
...@@ -18,6 +18,7 @@ from django.urls import path, include ...@@ -18,6 +18,7 @@ from django.urls import path, include
from django.conf.urls.static import static from django.conf.urls.static import static
from django.conf import settings from django.conf import settings
from homepage.views import WidgetUserCreateView from homepage.views import WidgetUserCreateView
from announcement_board.views import AnnouncementCreateView
urlpatterns = [ urlpatterns = [
path('homepage/', include("homepage.urls", namespace='homepage')), path('homepage/', include("homepage.urls", namespace='homepage')),
...@@ -27,6 +28,8 @@ urlpatterns = [ ...@@ -27,6 +28,8 @@ urlpatterns = [
path('forum/', include("forum.urls", namespace='forum')), path('forum/', include("forum.urls", namespace='forum')),
path('announcements/', include("announcement_board.urls", path('announcements/', include("announcement_board.urls",
namespace='announcement_board')), namespace='announcement_board')),
path('announcements/add', AnnouncementCreateView.as_view(),
name='announcement_form'),
path('assignments/', include("assignments.urls", namespace='assignments')), path('assignments/', include("assignments.urls", namespace='assignments')),
] ]
......
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