adding supporters view

Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
rascencio 2016-02-03 07:27:29 -06:00
parent 8b8d7733d3
commit 559fe2f698
5 changed files with 51 additions and 3 deletions

View file

@ -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)

View file

@ -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)

View file

@ -0,0 +1,35 @@
{% extends "digitalglarus/base.html" %}
{% load staticfiles %}
{% block title %}About{% endblock %}
{% block content %}
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">
Supporters
</h2>
<hr>
</div>
<div class="col-md-6">
<img class="img-responsive img-border-left" src="{% static 'digitalglarus/img/img_4.png' %}" alt="">
</div>
<div class="col-md-6">
{% for support in supporters %}
<div class="col-md-4">
<p>
{{ support.name }}
</p>
<p>
{{ support.description }}
</p>
</div>
{% endfor %}
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- /.container -->
{% endblock %}

View file

@ -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<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
]

View file

@ -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)