added supporters plugin

Signed-off-by: rscnt <rascnt@gmail.com>
This commit is contained in:
rascencio 2016-02-14 09:47:07 -06:00
parent 30b1e5f9c3
commit d6ddbc31ce
7 changed files with 79 additions and 16 deletions

View file

@ -1,6 +1,6 @@
from cms.plugin_base import CMSPluginBase from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool from cms.plugin_pool import plugin_pool
from .models import DGGalleryPlugin, Supporter from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
class CMSGalleryPlugin(CMSPluginBase): class CMSGalleryPlugin(CMSPluginBase):
@ -18,11 +18,12 @@ class CMSGalleryPlugin(CMSPluginBase):
class CMSSupportersPlugin(CMSPluginBase): class CMSSupportersPlugin(CMSPluginBase):
name = _("Digital Glarus Supporters") name = _("Digital Glarus Supporters")
model = DGSupportersPlugin
render_template = "digitalglarus/supporters_plugin.html" render_template = "digitalglarus/supporters_plugin.html"
def render(self, context, instance, placeholder): def render(self, context, instance, placeholder):
context.update({ context.update({
'supporters': Supporter.objects.all(), 'supporters': Supporter.objects.all().order_by('name'),
'object': instance, 'object': instance,
'placeholder':placeholder 'placeholder':placeholder
}) })

View file

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
('digitalglarus', '0007_auto_20160208_1031'),
]
operations = [
migrations.CreateModel(
name='DGSupportersPlugin',
fields=[
('cmsplugin_ptr', models.OneToOneField(primary_key=True, auto_created=True, parent_link=True, to='cms.CMSPlugin', serialize=False)),
('dgSupporters', models.ManyToManyField(to='digitalglarus.Supporter')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('digitalglarus', '0008_dgsupportersplugin'),
]
operations = [
migrations.RemoveField(
model_name='dgsupportersplugin',
name='dgSupporters',
),
]

View file

@ -22,6 +22,9 @@ class Supporter(models.Model):
def __str__(self): def __str__(self):
return "%s" % (self.name) return "%s" % (self.name)
def get_absolute_url(self):
return reverse('dgSupporters_view', args=[self.pk])
class DGGallery(models.Model): class DGGallery(models.Model):
parent = models.ForeignKey('self', blank=True, null=True) parent = models.ForeignKey('self', blank=True, null=True)
@ -46,3 +49,6 @@ class DGPicture(models.Model):
class DGGalleryPlugin(CMSPlugin): class DGGalleryPlugin(CMSPlugin):
dgGallery = models.ForeignKey(DGGallery) dgGallery = models.ForeignKey(DGGallery)
class DGSupportersPlugin(CMSPlugin):
pass

View file

@ -1,14 +1,8 @@
<div class="col-md-12"> <div class="row">
{{placeholder}} {% for supporter in supporters.all %}
<h1> WILLIWILLIWANKA </h1>
{% for supporter in supporters %}
<div class="col-md-6"> <div class="col-md-6">
<div class="thumbnail"> <h3 class="text-center">{{supporter.name}}</h3>
<div class="caption"> <p class="text-center">{{supporter.description}}</p>
<h3>{{supporter.name}}</h3>
<p>{{supporter.description}}</p>
</div> </div>
</div> {% endfor %}
</div>
{% endfor %}
</div> </div>

View file

@ -18,9 +18,6 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
{% show_menu 0 0 0 1 %} {% show_menu 0 0 0 1 %}
{% show_menu_below_id "digital-glarus-page" 0 %} {% show_menu_below_id "digital-glarus-page" 0 %}
<li>
<a href="{% url 'digitalglarus:supporters' %}">Supporters</a>
</li>
<li> <li>
<a href="{% url 'digitalglarus:blog' %}">Blog</a> <a href="{% url 'digitalglarus:blog' %}">Blog</a>
</li> </li>

View file

@ -0,0 +1,21 @@
{% extends "cms/digitalglarus/base.html" %}
{% load staticfiles cms_tags %}
{% block title %}About{% endblock %}
{% block content %}
<div class="row">
<div class="box">
<div class="col-lg-6">
{% placeholder 'two_columns_a' %}
</div>
<div class="col-lg-6">
{% placeholder 'two_columns_b' %}
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- /.container -->
{% endblock %}