Merge remote-tracking branch 'refs/remotes/origin/master'
mmit.
This commit is contained in:
parent
958ed9572b
commit
8f4dd038bd
44 changed files with 597 additions and 144 deletions
|
|
@ -1,4 +1,12 @@
|
|||
from django.contrib import admin
|
||||
from .models import Message
|
||||
from .models import Message, Supporter, DGGallery, DGPicture
|
||||
|
||||
class DGPictureInline(admin.StackedInline):
|
||||
model = DGPicture
|
||||
|
||||
class DGGalleryAdmin(admin.ModelAdmin):
|
||||
inlines = [DGPictureInline]
|
||||
|
||||
admin.site.register(DGGallery, DGGalleryAdmin)
|
||||
admin.site.register(Message)
|
||||
admin.site.register(Supporter)
|
||||
|
|
|
|||
33
digitalglarus/cms_plugins.py
Normal file
33
digitalglarus/cms_plugins.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from cms.plugin_base import CMSPluginBase
|
||||
from cms.plugin_pool import plugin_pool
|
||||
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
class CMSGalleryPlugin(CMSPluginBase):
|
||||
model = DGGalleryPlugin
|
||||
name = _("Digital Glarus Gallery")
|
||||
render_template = "digitalglarus/gallery.html"
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context.update({
|
||||
'gallery':instance.dgGallery,
|
||||
'object':instance,
|
||||
'placeholder':placeholder
|
||||
})
|
||||
return context
|
||||
|
||||
class CMSSupportersPlugin(CMSPluginBase):
|
||||
name = _("Digital Glarus Supporters")
|
||||
model = DGSupportersPlugin
|
||||
render_template = "digitalglarus/supporters_plugin.html"
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context.update({
|
||||
'supporters': Supporter.objects.all().order_by('name'),
|
||||
'object': instance,
|
||||
'placeholder':placeholder
|
||||
})
|
||||
return context
|
||||
|
||||
plugin_pool.register_plugin(CMSGalleryPlugin)
|
||||
plugin_pool.register_plugin(CMSSupportersPlugin)
|
||||
25
digitalglarus/migrations/0004_supporter.py
Normal file
25
digitalglarus/migrations/0004_supporter.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('digitalglarus', '0003_merge'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Supporter',
|
||||
fields=[
|
||||
('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)),
|
||||
('name', models.CharField(max_length=200)),
|
||||
('description', models.CharField(max_length=500)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
||||
20
digitalglarus/migrations/0005_auto_20160208_0218.py
Normal file
20
digitalglarus/migrations/0005_auto_20160208_0218.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('digitalglarus', '0004_supporter'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='supporter',
|
||||
name='description',
|
||||
field=models.TextField(),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import filer.fields.image
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0012_auto_20150607_2207'),
|
||||
('digitalglarus', '0005_auto_20160208_0218'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='DGGallery',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('parent', models.ForeignKey(blank=True, to='digitalglarus.DGGallery', null=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'dgGallery',
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DGGalleryPlugin',
|
||||
fields=[
|
||||
('cmsplugin_ptr', models.OneToOneField(primary_key=True, to='cms.CMSPlugin', auto_created=True, parent_link=True, serialize=False)),
|
||||
('dgGallery', models.ForeignKey(to='digitalglarus.DGGallery')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('cms.cmsplugin',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DGPicture',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
|
||||
('description', models.CharField(max_length=60)),
|
||||
('gallery', models.ForeignKey(to='digitalglarus.DGGallery')),
|
||||
('image', filer.fields.image.FilerImageField(related_name='dg_gallery', to='filer.Image')),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
||||
20
digitalglarus/migrations/0007_auto_20160208_1031.py
Normal file
20
digitalglarus/migrations/0007_auto_20160208_1031.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('digitalglarus', '0006_dggallery_dggalleryplugin_dgpicture'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='supporter',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
26
digitalglarus/migrations/0008_dgsupportersplugin.py
Normal file
26
digitalglarus/migrations/0008_dgsupportersplugin.py
Normal 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',),
|
||||
),
|
||||
]
|
||||
|
|
@ -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',
|
||||
),
|
||||
]
|
||||
19
digitalglarus/migrations/0010_auto_20160229_2106.py
Normal file
19
digitalglarus/migrations/0010_auto_20160229_2106.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('digitalglarus', '0009_remove_dgsupportersplugin_dgsupporters'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='message',
|
||||
name='email',
|
||||
field=models.EmailField(max_length=254),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
from django.db import models
|
||||
from cms.models import CMSPlugin
|
||||
from filer.fields.image import FilerImageField
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Message(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
|
|
@ -12,3 +13,42 @@ 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.TextField(null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.name)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('dgSupporters_view', args=[self.pk])
|
||||
|
||||
|
||||
class DGGallery(models.Model):
|
||||
parent = models.ForeignKey('self', blank=True, null=True)
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.name)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('dgGallery_view', args=[self.pk])
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = 'dgGallery'
|
||||
|
||||
class DGPicture(models.Model):
|
||||
gallery = models.ForeignKey(DGGallery)
|
||||
image = FilerImageField(related_name='dg_gallery')
|
||||
description = models.CharField(max_length=60)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.image.name)
|
||||
|
||||
class DGGalleryPlugin(CMSPlugin):
|
||||
dgGallery = models.ForeignKey(DGGallery)
|
||||
|
||||
class DGSupportersPlugin(CMSPlugin):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{% load menu_tags staticfiles cms_tags %}
|
||||
{% load staticfiles cms_tags menu_tags sekizai_tags menu_tags %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
@ -26,6 +26,9 @@
|
|||
<link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
|
||||
<link href="//fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">
|
||||
|
||||
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
|
||||
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
|
|
@ -45,7 +48,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
{% cms_toolbar %}
|
||||
<div class="brand">Digital Glarus</div>
|
||||
<div class="address-bar">The Swiss IT Valley | Schwanden, 8762 GL Switzerland | From 2015.10.13</div>
|
||||
|
||||
|
|
@ -68,6 +71,9 @@
|
|||
<ul class="nav navbar-nav">
|
||||
{% show_menu 0 0 0 1 %}
|
||||
{% show_menu_below_id "digital-glarus-page" 0 %}
|
||||
<li>
|
||||
<a href="{% url 'digitalglarus:supporters' %}">Supporters</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'digitalglarus:blog' %}">Blog</a>
|
||||
</li>
|
||||
|
|
|
|||
19
digitalglarus/templates/digitalglarus/gallery.html
Normal file
19
digitalglarus/templates/digitalglarus/gallery.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{% load thumbnail %}
|
||||
<div id="dg-gallery-{{gallery.name}}" class="carousel slide">
|
||||
<!-- Indicators --><!-- Wrapper for slides -->
|
||||
<div class="carousel-inner">
|
||||
{% for image in gallery.dgpicture_set.all %}
|
||||
<div class="item {% if forloop.first %} active {% endif %} ">
|
||||
<img class="img-responsive img-full" src="{{ image.image.url }}" alt="{{ image.description }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Controls -->
|
||||
<a class="left carousel-control" href="#dg-gallery-{{gallery.name}}" data-slide="prev">
|
||||
<span class="icon-prev"></span>
|
||||
</a>
|
||||
<a class="right carousel-control" href="#dg-gallery-{{gallery.name}}" data-slide="next">
|
||||
<span class="icon-next"></span>
|
||||
</a>
|
||||
</div>
|
||||
32
digitalglarus/templates/digitalglarus/supporters.html
Normal file
32
digitalglarus/templates/digitalglarus/supporters.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{% 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-12">
|
||||
{% for supporter in supporters %}
|
||||
<div class="col-md-6">
|
||||
<div class="thumbnail">
|
||||
<div class="caption">
|
||||
<h3>{{supporter.name}}</h3>
|
||||
<p>{{supporter.description}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.container -->
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<div class="row">
|
||||
{% for supporter in supporters.all %}
|
||||
<div class="col-md-12">
|
||||
<h3 class="text-center">{{supporter.name}}</h3>
|
||||
<p class="text-center">{{supporter.description}}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
@ -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'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue