Commit e4182b16 authored by Carlo Joseph Echon's avatar Carlo Joseph Echon 🐟

Changed the redirect route after creation of new announcement, and changed add.html styling

parent dd3024ee
from pickle import TRUE
from django.db import models
from homepage.models import WidgetUser
from django.urls import reverse
......@@ -17,7 +16,7 @@ class Announcement(models.Model):
return self.announcement_title
def get_absolute_url(self):
return reverse('announcements:indexAnnouncements')
return u'%d/details' % self.pk
class Reaction(models.Model):
LIKE = "Like"
......
......@@ -11,7 +11,12 @@
<div>
<form method="POST", enctype="multipart/form-data" >
{% csrf_token %}
{{form.as_p}}
Announcement title: {{form.announcement_title}}<br>
Announcement body: <br>{{form.announcement_body}}<br>
Author: {{form.author}}<br>
Image: {{form.announcement_image}}<br>
<button>Save Announcement</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
......@@ -6,5 +6,5 @@ app_name = "announcements"
urlpatterns = [
path('', views.index, name="indexAnnouncements"),
path('<int:announcement_id>/details', views.details, name="detailsAnnouncements"),
path('add/', addAnnouncement.as_view(), name="addAnnouncements"),
path('add', addAnnouncement.as_view(), name="addAnnouncements"),
]
\ No newline at end of file
from multiprocessing import context
from django.http import HttpResponse, Http404
from django.http import Http404
from .models import Announcement, Reaction
from django.shortcuts import render
from django.views.generic import CreateView
......
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