From 559fe2f698f0737c6466a98f6df6715b98d42957 Mon Sep 17 00:00:00 2001 From: rscnt Date: Wed, 3 Feb 2016 07:27:29 -0600 Subject: [PATCH] adding supporters view Signed-off-by: rscnt --- digitalglarus/admin.py | 3 +- digitalglarus/models.py | 6 +++- .../templates/digitalglarus/supporters.html | 35 +++++++++++++++++++ digitalglarus/urls.py | 1 + digitalglarus/views.py | 9 ++++- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 digitalglarus/templates/digitalglarus/supporters.html diff --git a/digitalglarus/admin.py b/digitalglarus/admin.py index a44a4f56..31bd8c97 100644 --- a/digitalglarus/admin.py +++ b/digitalglarus/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin -from .models import Message +from .models import Message, Supporter admin.site.register(Message) +admin.site.register(Supporter) diff --git a/digitalglarus/models.py b/digitalglarus/models.py index a7535966..f8939972 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -1,6 +1,5 @@ from django.db import models -# Create your models here. class Message(models.Model): name = models.CharField(max_length=200) @@ -12,3 +11,8 @@ class Message(models.Model): def __str__(self): return "%s - %s - %s" % (self.name, self.email, self.received_date) + + +class Supporter(models.Model): + name = models.CharField(max_length=200) + description = models.CharField(max_length=500) diff --git a/digitalglarus/templates/digitalglarus/supporters.html b/digitalglarus/templates/digitalglarus/supporters.html new file mode 100644 index 00000000..6222b734 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/supporters.html @@ -0,0 +1,35 @@ +{% extends "digitalglarus/base.html" %} +{% load staticfiles %} +{% block title %}About{% endblock %} + +{% block content %} +
+
+
+
+

+ Supporters +

+
+
+
+ +
+
+ {% for support in supporters %} +
+

+ {{ support.name }} +

+

+ {{ support.description }} +

+
+ {% endfor %} +
+
+
+
+ + +{% endblock %} diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index 44d881e0..e3b29b9e 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -8,6 +8,7 @@ urlpatterns = [ url(r'old_contact$', views.contact, name='contact'), url(r'old_letscowork$', views.letscowork, name='letscowork'), url(r'old_home$', views.home, name='home'), + url(r'supporters/$', views.supporters, name='supporters'), url(r'blog/$', views.blog, name='blog'), url(r'^blog/(?P\w[-\w]*)/$', views.blog_detail, name='blog-detail'), ] diff --git a/digitalglarus/views.py b/digitalglarus/views.py index d509ee38..86856b6f 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse from django.utils.translation import get_language from djangocms_blog.models import Post -from .models import Message +from .models import Message, Supporter class MessageForm(ModelForm): required_css_class = 'form-control' @@ -75,3 +75,10 @@ def blog_detail(request, slug): 'post': post, } return render(request, 'glarus_blog/post_detail.html', context) + + +def supporters(request): + context = { + 'supporters': Supporter.objects.order_by('name') + } + return render(request, 'digitalglarus/supporters.html', context)