Commit 1bb55877 authored by Neal Berones's avatar Neal Berones

converted announcements index view into CBV, tested populating announcements model using forms

parent 3c4a7fcf
p{ p{
color: white; color: black;
font-weight: bold; font-weight: bold;
font-family: Helvetica; font-family: Helvetica;
font-size:25px; font-size:25px;
...@@ -7,12 +7,12 @@ p{ ...@@ -7,12 +7,12 @@ p{
h1 { h1 {
position: sticky; position: sticky;
text-align: left; text-align: left;
color: white; color: black;
font-size: 55px; font-size: 55px;
font-family: Helvetica; font-family: Helvetica;
} }
body { body {
background-image: url("/static/bg.png"); background-image: url("/static/announcements/bg.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
background-position: center; background-position: center;
...@@ -20,14 +20,14 @@ body { ...@@ -20,14 +20,14 @@ body {
font-family: Helvetica; font-family: Helvetica;
} }
a{ a{
color: white; color: black;
font-family: Helvetica; font-family: Helvetica;
font-weight: bold; font-weight: bold;
} }
ol { ol {
font-size:35px; font-size:35px;
font-family: Helvetica; font-family: Helvetica;
color:white; color:black;
font-weight: bold; font-weight: bold;
} }
a:link { a:link {
......
...@@ -3,7 +3,7 @@ from . import views ...@@ -3,7 +3,7 @@ from . import views
app_name = "announcements" app_name = "announcements"
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), path('', views.IndexView.as_view(), name='index'),
path('add/', views.add, name='add'), path('add/', views.add, name='add'),
path('<int:announcement_id>/details', views.detail, name="detail") path('<int:announcement_id>/details', views.detail, name="detail")
#path('welcome', views.welcome, name='welcome') #path('welcome', views.welcome, name='welcome')
......
...@@ -4,8 +4,15 @@ from django.shortcuts import render, redirect ...@@ -4,8 +4,15 @@ from django.shortcuts import render, redirect
from .models import WidgetUser, Announcement, Reaction from .models import WidgetUser, Announcement, Reaction
from .forms import AnnouncementForm from .forms import AnnouncementForm
from django.template import loader from django.template import loader
from django.views import View
# Create your views here. # Create your views here.
class IndexView(View):
def get(self,request):
announcements_list = Announcement.objects.all().order_by("pub_date")
return render(request, "announcements/index.html", {"announcements_list":announcements_list})
'''
def index(request): def index(request):
announcements_list = Announcement.objects.all().order_by("pub_date") announcements_list = Announcement.objects.all().order_by("pub_date")
#template = loader.get_template("announcements/index.html") #template = loader.get_template("announcements/index.html")
...@@ -13,7 +20,7 @@ def index(request): ...@@ -13,7 +20,7 @@ def index(request):
"announcements_list":announcements_list "announcements_list":announcements_list
} }
return render(request, "announcements/index.html", context) return render(request, "announcements/index.html", context)
'''
#HttpResponse(template.render(context, request)) #HttpResponse(template.render(context, request))
def detail(request, announcement_id): def detail(request, announcement_id):
......
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