diff --git a/OACPL/urls.py b/OACPL/urls.py index ad1f93e..2392b59 100644 --- a/OACPL/urls.py +++ b/OACPL/urls.py @@ -8,17 +8,20 @@ from django.views.static import serve import main.views import charter_members.views +import newsletters.views @login_required def protected_serve(request, path, document_root=None, show_indexes=False): return serve(request, path, document_root, show_indexes) + urlpatterns = [ url(r'^$', main.views.index, name='home'), url(r'^admin/logout', main.views.logout, name='logout'), url(r'^admin/', admin.site.urls, name='admin'), url(r'^attorney/(?P\d+)', charter_members.views.index, name='attorney'), url(r'^media/secure/(?P.*)$', protected_serve, {'document_root': os.path.join(settings.MEDIA_ROOT, 'secure')}, name='secure media'), - url(r'^media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media') + url(r'^media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'), + url(r'^newsletter/', newsletters.views.newsletters, name='newsletters') ] diff --git a/newsletters/templates/newsletters.html b/newsletters/templates/newsletters.html new file mode 100644 index 0000000..b576a73 --- /dev/null +++ b/newsletters/templates/newsletters.html @@ -0,0 +1,42 @@ +{% extends 'base.html' %} + +{% block body %} + + +
+
+ {% for newsletter in newsletters %} + + {% endfor %} +
+
+ + +{% endblock %} \ No newline at end of file diff --git a/newsletters/views.py b/newsletters/views.py index 91ea44a..b094a9d 100644 --- a/newsletters/views.py +++ b/newsletters/views.py @@ -1,3 +1,8 @@ from django.shortcuts import render -# Create your views here. +from .models import Newsletter + + +def newsletters(request): + newsletters = Newsletter.objects.all() + return render(request, 'newsletters.html', {'newsletters': newsletters}) diff --git a/templates/base.html b/templates/base.html index e43a940..39b9a13 100644 --- a/templates/base.html +++ b/templates/base.html @@ -38,11 +38,8 @@ - -
  • + NEWSLETTERS