Commit d93774ec authored by MJoshBen's avatar MJoshBen

Revert "Populated Models and Fixed Errors"

This reverts commit dec57490.
parent dec57490
......@@ -3,4 +3,4 @@ from django.apps import AppConfig
class AnnouncementConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'announcements'
name = 'announcement'
......@@ -11,19 +11,14 @@ class Announcement(models.Model):
def __str__(self):
return '{} by {} published {}: {}'.format(self.title, self.author, self.pub_datetime, self.body)
def announcement_title(self):
return '{}'.format(self.title)
def get_absolute_url(self):
return reverse('announcement:announcement-details', kwargs={'pk':self.pk})
class Reaction(models.Model):
reaction_list = [("Like", "Like"), ("Heart", "Heart"), ("Angry", "Angry")]
name = models.CharField(max_length=10, choices = reaction_list, default = "Like")
tally = models.IntegerField()
tally = models.IntegerField(null = True)
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE)
def __str__(self):
return '{}: {}'.format(self.name, self.tally)
......@@ -7,11 +7,11 @@
<h3> {{ announcement.pub_datetime }}</h3>
<h3> {{ announcement.body }}<br>
{% for reaction in announcement.reaction_set.all %}
{{ reaction.name }}: {{ reaction.tally }}<br>
{% endfor %}
{{ reaction.name }}: {{ reaction.tally }}<br>
{{ reaction.name }}: {{ reaction.tally }}<br>
</h3>
{% endblock %}
{% block scripts %}
<a href="/announcements/{{ announcement.pk }}/edit"><input type="submit" value="Edit Announcement"></a>
<a href="/announcements/{{ reaction.announcement.pk }}/edit"><input type="submit" value="Edit Announcement"></a>
{% endblock %}
......@@ -5,12 +5,12 @@
<h1>Welcome to Widget's Announcement Board!</h1>
<h3>
{% for announcement in announcements %}
<a href="{{ announcement.get_absolute_url }}">{{ announcement.announcement_title }} by {{announcement.author}}</a><br>
<a href="{{ announcement.get_absolute_url }}">{{ announcement.name }}</a><br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a href="/announcements/add"><input type="submit" value="New Announcement"></a><br><br>
<a href="/announcement/add"><input type="submit" value="New Announcement"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/assignments">Assignments</a><br>
<a href="/forum">Forum</a><br>
......
......@@ -5,13 +5,13 @@ from django.views.generic.edit import CreateView
from .models import Announcement
def index(request):
return render(request, 'announcements/announcement.html', {'announcement': Announcement.objects.all()})
return render(request, 'announcement/announcement.html', {'announcement': Announcement.objects.all()})
class AnnouncementDetailView(DetailView):
model = Announcement
def get(self, request, pk):
return render(request, 'announcements/announcement-details.html', {'announcement': self.model.objects.get(pk=pk)})
return render(request, 'announcement/announcement-details.html', {'announcement': self.model.objects.get(pk=pk)})
class AnnouncementCreateView(CreateView):
model = Announcement
......
......@@ -12,7 +12,7 @@
{% block scripts %}
<a href="/assignments/add"><input type="submit" value="New Assignment"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/announcements">Announcements</a><br>
<a href="/announcement">Announcements</a><br>
<a href="/forum">Forum</a><br>
<a href="/calendar">Calendar</a>
{% endblock %}
\ No newline at end of file
......@@ -12,7 +12,7 @@
{% endblock %}
{% block scripts %}
<a href="/dashboard/widgetusers/add"><input type="submit" value="Add Widget User"></a><br>
<a href="/announcements">Announcement Board</a><br>
<a href="/announcement">Announcement Board</a><br>
<a href="/forum">Forum</a><br>
<a href="/assignments">Assignments</a><br>
<a href="/calendar">Calendar</a>
......
No preview for this file type
......@@ -12,7 +12,7 @@
{% block scripts %}
<a href="/forum/forumposts/add"><input type="submit" value="New Post"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/announcements">Announcements</a><br>
<a href="/announcement">Announcements</a><br>
<a href="/assignments">Assignments</a><br>
<a href="/calendar">Calendar</a>
{% endblock %}
\ No newline at end of file
......@@ -13,7 +13,7 @@
{% block scripts %}
<a href="/calendar/events/add"><input type="submit" value="New Activity"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/announcements">Announcement Board</a><br>
<a href="/announcement">Announcement Board</a><br>
<a href="/forum">Forum</a><br>
<a href="/assignments">Assignments</a><br>
{% endblock %}
\ No newline at end of file
......@@ -42,7 +42,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'announcements',
'announcement',
'assignments',
'dashboard',
'forum',
......
......@@ -2,7 +2,7 @@ from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('announcements/', include('announcements.urls', namespace="announcements")),
path('announcement/', include('announcement.urls', namespace="announcement")),
path('calendar/', include('widget_calendar.urls', namespace="widget_calendar")),
path('assignments/', include('assignments.urls', namespace="assignments")),
path('dashboard/', include('dashboard.urls', namespace="dashboard")),
......
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