diff --git a/digitalglarus/templates/cms/__init__.py b/cms_templates/__init__.py similarity index 100% rename from digitalglarus/templates/cms/__init__.py rename to cms_templates/__init__.py diff --git a/digitalglarus/templates/cms/digitalglarus/detail.html b/cms_templates/detail.html similarity index 100% rename from digitalglarus/templates/cms/digitalglarus/detail.html rename to cms_templates/detail.html diff --git a/templates/djangocms_blog/_header_post_detail.html b/cms_templates/djangocms_blog/_header_post_detail.html similarity index 90% rename from templates/djangocms_blog/_header_post_detail.html rename to cms_templates/djangocms_blog/_header_post_detail.html index 961e07d8..669de5bc 100644 --- a/templates/djangocms_blog/_header_post_detail.html +++ b/cms_templates/djangocms_blog/_header_post_detail.html @@ -4,6 +4,8 @@
@@ -32,4 +34,4 @@
-
+ \ No newline at end of file diff --git a/cms_templates/djangocms_blog/base.html b/cms_templates/djangocms_blog/base.html new file mode 100644 index 00000000..bbaceb61 --- /dev/null +++ b/cms_templates/djangocms_blog/base.html @@ -0,0 +1,19 @@ +{% extends 'base_glarus.html' %} + +{% block meta %} + {% if meta %} + {% include "meta_mixin/meta.html" %} + {% endif %} +{% endblock meta %} + +
+ {% block content %} +
+
+
+ {% block content_blog %}{% endblock %} +
+
+
+ {% endblock content %} +
diff --git a/cms_templates/djangocms_blog/post_detail.html b/cms_templates/djangocms_blog/post_detail.html new file mode 100644 index 00000000..197bab96 --- /dev/null +++ b/cms_templates/djangocms_blog/post_detail.html @@ -0,0 +1,35 @@ +{% extends "djangocms_blog/base.html" %} +{% load i18n thumbnail cms_tags %} + +{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} +{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %} +{% block canonical_url %}{% endblock canonical_url %} +{% block title %}{{ post.get_title }}{% endblock %} + +{% block content_blog %}{% spaceless %} +
+ {% if post.main_image_id %} +
+ {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
+ {% endif %} +
+
+

+ + {{ post.title }} + + + {{ post.date_created }} + +

+
+ {% block blog_meta %} + {# include "glarus_blog/includes/blog_meta.html" #} + {% endblock %} +
+ {% endspaceless %} +
{% render_placeholder post.content %}
+
+{% endblock content_blog %} \ No newline at end of file diff --git a/cms_templates/djangocms_blog/post_list.html b/cms_templates/djangocms_blog/post_list.html new file mode 100644 index 00000000..eb1ce71b --- /dev/null +++ b/cms_templates/djangocms_blog/post_list.html @@ -0,0 +1,47 @@ +{% extends "djangocms_blog/base.html" %} +{% load i18n thumbnail %}{% spaceless %} + +{% block canonical_url %}{% endblock canonical_url %} + +{% block content_blog %} +
+ {% block blog_title %} +
+

+ {% if author %}{% trans "Articles by" %} {{ author.get_full_name }} + {% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }} + {% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }} + {% elif category %}{% trans "Category" %} – {{ category }}{% endif %} +

+
+ {% endblock %} + {% for post in post_list %} + {% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} + {% empty %} +

{% trans "No article found." %}

+ {% endfor %} + {% if author or archive_date or tagged_entries %} +

{% trans "Back" %}

+ {% endif %} + {% if is_paginated %} + + + {% endif %} +
+{% endblock %} +{% endspaceless %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/gallery.html b/cms_templates/gallery.html similarity index 100% rename from digitalglarus/templates/digitalglarus/gallery.html rename to cms_templates/gallery.html diff --git a/cms_templates/includes/blog_item.html b/cms_templates/includes/blog_item.html new file mode 100644 index 00000000..4a23f701 --- /dev/null +++ b/cms_templates/includes/blog_item.html @@ -0,0 +1,33 @@ +{% load i18n thumbnail %} +{% get_current_language as LANGUAGE_CODE %} +
+ {% if post.main_image %} +
+ {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
+ {% endif %} +
+
+

+ + {{ post.title }} + + + {{ post.date_created }} + +

+
+ {% block blog_meta %} + {# include "glarus_blog/includes/blog_meta.html" #} + {% endblock %} +
+
+

+ {{ post.abstract| safe }} +

+
+
+ {% trans "read more" %} » +
+
\ No newline at end of file diff --git a/cms_templates/includes/blog_meta.html b/cms_templates/includes/blog_meta.html new file mode 100644 index 00000000..253dbaa7 --- /dev/null +++ b/cms_templates/includes/blog_meta.html @@ -0,0 +1,23 @@ +{% load i18n thumbnail %} + + + \ No newline at end of file diff --git a/digitalglarus/templates/cms/digitalglarus/letscowork.html b/cms_templates/letscowork.html similarity index 97% rename from digitalglarus/templates/cms/digitalglarus/letscowork.html rename to cms_templates/letscowork.html index 71b0aae7..76a5c0d4 100644 --- a/digitalglarus/templates/cms/digitalglarus/letscowork.html +++ b/cms_templates/letscowork.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load staticfiles cms_tags %} {% block title %}crowdfunding{% endblock %} diff --git a/digitalglarus/templates/cms/digitalglarus/one_column.html b/cms_templates/one_column.html similarity index 88% rename from digitalglarus/templates/cms/digitalglarus/one_column.html rename to cms_templates/one_column.html index a808028e..b6d6495a 100644 --- a/digitalglarus/templates/cms/digitalglarus/one_column.html +++ b/cms_templates/one_column.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load staticfiles cms_tags %} {% block title %}About{% endblock %} diff --git a/digitalglarus/templates/digitalglarus/supporters_plugin.html b/cms_templates/supporters_plugin.html similarity index 100% rename from digitalglarus/templates/digitalglarus/supporters_plugin.html rename to cms_templates/supporters_plugin.html diff --git a/digitalglarus/templates/cms/digitalglarus/two_columns.html b/cms_templates/two_columns.html similarity index 89% rename from digitalglarus/templates/cms/digitalglarus/two_columns.html rename to cms_templates/two_columns.html index 6893b5de..83f30927 100644 --- a/digitalglarus/templates/cms/digitalglarus/two_columns.html +++ b/cms_templates/two_columns.html @@ -1,4 +1,4 @@ -{% extends "cms/digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load staticfiles cms_tags %} {% block title %}About{% endblock %} diff --git a/digitalglarus/admin.py b/digitalglarus/admin.py index 14f5af7a..92dea7a0 100644 --- a/digitalglarus/admin.py +++ b/digitalglarus/admin.py @@ -1,12 +1,12 @@ from django.contrib import admin -# from .models import Message, Supporter, DGGallery, DGPicture +from .models import Message, Supporter, DGGallery, DGPicture +# +class DGPictureInline(admin.StackedInline): + model = 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) +class DGGalleryAdmin(admin.ModelAdmin): + inlines = [DGPictureInline] + +admin.site.register(DGGallery, DGGalleryAdmin) +admin.site.register(Message) +admin.site.register(Supporter) \ No newline at end of file diff --git a/digitalglarus/cms_plugins.py b/digitalglarus/cms_plugins.py index 10989df9..e58dffb9 100644 --- a/digitalglarus/cms_plugins.py +++ b/digitalglarus/cms_plugins.py @@ -1,36 +1,36 @@ -# from cms.plugin_base import CMSPluginBase -# from cms.plugin_pool import plugin_pool -# from cms.wizards import wizard_base -# 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" +from cms.plugin_base import CMSPluginBase +from cms.plugin_pool import plugin_pool +from cms.wizards import wizard_base +from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter +from django.utils.translation import ugettext as _ # -# def render(self, context, instance, placeholder): -# context.update({ -# 'gallery':instance.dgGallery, -# 'object':instance, -# 'placeholder':placeholder -# }) -# return context +class CMSGalleryPlugin(CMSPluginBase): + model = DGGalleryPlugin + name = _("Digital Glarus Gallery") + render_template = "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 = "supporters_plugin.html" + + def render(self, context, instance, placeholder): + context.update({ + 'supporters': Supporter.objects.all().order_by('name'), + '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) +# +plugin_pool.register_plugin(CMSGalleryPlugin) +plugin_pool.register_plugin(CMSSupportersPlugin) diff --git a/digitalglarus/migrations/0004_dggallery_dggalleryplugin_dgpicture_dgsupportersplugin_supporter.py b/digitalglarus/migrations/0004_dggallery_dggalleryplugin_dgpicture_dgsupportersplugin_supporter.py new file mode 100644 index 00000000..fdcb3155 --- /dev/null +++ b/digitalglarus/migrations/0004_dggallery_dggalleryplugin_dgpicture_dgsupportersplugin_supporter.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-03-30 22:23 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import filer.fields.image + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0013_urlconfrevision'), + ('filer', '0002_auto_20150606_2003'), + ('digitalglarus', '0003_auto_20160325_1659'), + ] + + operations = [ + migrations.CreateModel( + name='DGGallery', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=30)), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='digitalglarus.DGGallery')), + ], + options={ + 'verbose_name_plural': 'dgGallery', + }, + ), + migrations.CreateModel( + name='DGGalleryPlugin', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('dgGallery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='digitalglarus.DGGallery')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + migrations.CreateModel( + name='DGPicture', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.CharField(max_length=60)), + ('gallery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='digitalglarus.DGGallery')), + ('image', filer.fields.image.FilerImageField(on_delete=django.db.models.deletion.CASCADE, related_name='dg_gallery', to='filer.Image')), + ], + ), + migrations.CreateModel( + name='DGSupportersPlugin', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + migrations.CreateModel( + name='Supporter', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200)), + ('description', models.TextField(blank=True, null=True)), + ], + ), + ] diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 5c79120f..aff56990 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -18,7 +18,7 @@ class Message(models.Model): class Supporter(models.Model): name = models.CharField(max_length=200) description = models.TextField(null=True, blank=True) - + def __str__(self): return "%s" % (self.name) @@ -39,16 +39,36 @@ class Supporter(models.Model): # 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.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' # -# def __str__(self): -# return "%s" % (self.image.name) -# -# class DGGalleryPlugin(CMSPlugin): -# dgGallery = models.ForeignKey(DGGallery) -# -# class DGSupportersPlugin(CMSPlugin): -# pass +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 diff --git a/digitalglarus/templates/cms/digitalglarus/about.html b/digitalglarus/templates/about.html similarity index 96% rename from digitalglarus/templates/cms/digitalglarus/about.html rename to digitalglarus/templates/about.html index 8a0da727..a63a58ac 100755 --- a/digitalglarus/templates/cms/digitalglarus/about.html +++ b/digitalglarus/templates/about.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load staticfiles cms_tags %} {% block title %}About{% endblock %} @@ -54,4 +54,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/base.html b/digitalglarus/templates/base_glarus.html similarity index 100% rename from digitalglarus/templates/digitalglarus/base.html rename to digitalglarus/templates/base_glarus.html diff --git a/digitalglarus/templates/cms/digitalglarus/__init__.py b/digitalglarus/templates/cms/digitalglarus/__init__.py deleted file mode 100644 index 986404f9..00000000 --- a/digitalglarus/templates/cms/digitalglarus/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -from django.utils.translation import ugettext_lazy as _ -TEMPLATES = { - 'about.html': _('DG.About'), - 'contact.html': _('DG.Contact'), - 'index.html': _('DG.Home'), - 'letscowork.html': _('DG.CoWork'), - 'detail.html': _('DG.Detail'), - 'one_column.html': _('DG.OneColumn'), -} diff --git a/digitalglarus/templates/cms/digitalglarus/base.html b/digitalglarus/templates/cms/digitalglarus/base.html deleted file mode 100644 index 684e92bb..00000000 --- a/digitalglarus/templates/cms/digitalglarus/base.html +++ /dev/null @@ -1,96 +0,0 @@ -{% load staticfiles cms_tags menu_tags sekizai_tags menu_tags %} - - - - - - - - - - - - - {% page_attribute "page_title" %} - - - - - - - - - - - - - - - - - - - {% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %} - {% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %} - - - - - {% cms_toolbar %} -
Digital Glarus
-
-{# {% placeholder 'digital_glarus_legend' %}#} -
-
- -
- - - {% include "cms/digitalglarus/partials/menu.html" %} - -
- {% block content %} {% endblock %} -
- - - - - - - - - - - - - - - - - diff --git a/digitalglarus/templates/cms/digitalglarus/partials/language-chooser.html b/digitalglarus/templates/cms/digitalglarus/partials/language-chooser.html deleted file mode 100644 index c3b75cd6..00000000 --- a/digitalglarus/templates/cms/digitalglarus/partials/language-chooser.html +++ /dev/null @@ -1,9 +0,0 @@ -{% load i18n menu_tags %} - -{% if languages|length > 1 %} -{% for language in languages %} -
  • - {{ language.1 }} -
  • -{% endfor %} -{% endif %} diff --git a/digitalglarus/templates/cms/digitalglarus/partials/menu.html b/digitalglarus/templates/cms/digitalglarus/partials/menu.html deleted file mode 100644 index b7d223fa..00000000 --- a/digitalglarus/templates/cms/digitalglarus/partials/menu.html +++ /dev/null @@ -1,26 +0,0 @@ -{% load menu_tags staticfiles cms_tags %} - - diff --git a/digitalglarus/templates/cms/digitalglarus/contact.html b/digitalglarus/templates/contact.html similarity index 96% rename from digitalglarus/templates/cms/digitalglarus/contact.html rename to digitalglarus/templates/contact.html index 01a57109..11767a8a 100755 --- a/digitalglarus/templates/cms/digitalglarus/contact.html +++ b/digitalglarus/templates/contact.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load cms_tags %} {% block title %}Contact{% endblock %} @@ -62,4 +62,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/about.html b/digitalglarus/templates/digitalglarus/about.html deleted file mode 100755 index 6aa4a185..00000000 --- a/digitalglarus/templates/digitalglarus/about.html +++ /dev/null @@ -1,72 +0,0 @@ -{% extends "digitalglarus/base.html" %} -{% load staticfiles %} -{% block title %}About{% endblock %} - -{% block content %} -
    -
    -
    -
    -

    why - Us? -

    -
    -
    -
    - -
    -
    -

    - We, the ungleich GmbH, were founded 2013 in Switzerland - - however our first incarnation in Germany dates back to 2000. - We have long knowledge in tech industry, and have extensive - networks with small to medium tech companies in Switzerland, - because we are one of them. We have been working at coworking - spaces with these small to medium sized IT companies ; - tech-savvy and flexible, tech companies have open culture in - work environment, and very often experience difficulty in - letting their employees be as creative as possible. We - understand and share their needs and problems. This is how we - came up with a solution of our own, of finding and providing - an attractive working space for technology companies - in Switzerland. -

    -
    -
    -
    -
    - -
    -
    -
    -
    -

    why - glarus? -

    -
    -
    -
    - -

    BEAUTIFUL - landscape -

    -
    -
    - -

    AFFORDABLE - price

    -
    -
    - -

    direct - connection to zurich -

    -
    -
    -
    -
    - - - - -{% endblock %} diff --git a/digitalglarus/templates/digitalglarus/detail.html b/digitalglarus/templates/digitalglarus/detail.html deleted file mode 100644 index 412a6b91..00000000 --- a/digitalglarus/templates/digitalglarus/detail.html +++ /dev/null @@ -1,11 +0,0 @@ -

    {{ message }}

    - - - -

    Back to Main diff --git a/digitalglarus/templates/glarus_blog/base.html b/digitalglarus/templates/glarus_blog/base.html index 40ad0c65..a7ecc8a6 100644 --- a/digitalglarus/templates/glarus_blog/base.html +++ b/digitalglarus/templates/glarus_blog/base.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% block meta %} {% if meta %} @@ -16,4 +16,4 @@ {% endblock content %} - + \ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/includes/blog_item.html b/digitalglarus/templates/glarus_blog/includes/blog_item.html index 4a776bee..667c0111 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_item.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_item.html @@ -29,4 +29,4 @@

    {% trans "read more" %} »
    - + \ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/includes/blog_meta.html b/digitalglarus/templates/glarus_blog/includes/blog_meta.html index b9e78570..253dbaa7 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_meta.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_meta.html @@ -20,4 +20,4 @@
  • {{ tag.name }}{% if not forloop.last %}, {% endif %}
  • {% endfor %} {% endif %} - + \ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/post_detail.html b/digitalglarus/templates/glarus_blog/post_detail.html index cd89f8f2..807fad33 100644 --- a/digitalglarus/templates/glarus_blog/post_detail.html +++ b/digitalglarus/templates/glarus_blog/post_detail.html @@ -1,4 +1,4 @@ -{% extends "glarus_blog/base.html" %} +{% extends "base_glarus.html" %} {% load i18n thumbnail cms_tags %} {% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} @@ -7,7 +7,6 @@ {% block title %}{{ post.get_title }}{% endblock %} {% block content_blog %}{% spaceless %} - {% debug %}
    {% if post.main_image_id %}
    @@ -18,7 +17,7 @@

    - + {{ post.title }} @@ -27,10 +26,10 @@


    {% block blog_meta %} - include "glarus_blog/includes/blog_meta.html" + {# include "glarus_blog/includes/blog_meta.html" #} {% endblock %}
    {% endspaceless %}
    {% render_placeholder post.content %}
    -{% endblock content_blog %} +{% endblock content_blog %} \ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/post_list.html b/digitalglarus/templates/glarus_blog/post_list.html index a05ae060..cfd90d3e 100644 --- a/digitalglarus/templates/glarus_blog/post_list.html +++ b/digitalglarus/templates/glarus_blog/post_list.html @@ -1,4 +1,4 @@ -{% extends "glarus_blog/base.html" %} +{% extends "base.html" %} {% load i18n thumbnail %}{% spaceless %} {% block canonical_url %}{% endblock canonical_url %} @@ -32,4 +32,4 @@ {% endif %} {% endblock %} -{% endspaceless %} +{% endspaceless %} \ No newline at end of file diff --git a/digitalglarus/templates/index.html b/digitalglarus/templates/index.html new file mode 100644 index 00000000..d7894fb2 --- /dev/null +++ b/digitalglarus/templates/index.html @@ -0,0 +1,99 @@ +{% extends "base_glarus.html" %} +{% load staticfiles cms_tags %} + +{% block content %} +
    +
    +
    + +

    + WELCOME TO +

    +

    Digital Glarus

    +
    +

    + By + ungleich gmbh + +

    +
    +
    +
    + +
    +
    +
    +
    +

    + {% placeholder 'digital_glarus_build_a_tech_valley' %} +

    +
    + +
    + {% placeholder 'digital_glarus_build_a_tech_valley_content' %} +

     

    +
    +
    +
    + +
    +
    +
    +
    +

    + {% placeholder 'digital_glarus_a_new_area' %} +

    +
    + {% placeholder 'digital_glarus_a_new_area_content' %} +
    +
    +
    + +
    +
    +
    +
    +

    + {% placeholder 'digital_glarus_why_be_interested' %} +

    +
    + {% placeholder 'digital_glarus_why_be_interested_content' %} +
    +
    +
    +
    +
    +
    +
    +

    + {% placeholder 'digital_glarus_where_we_are' %} +

    +
    + {% placeholder 'digital_glarus_where_we_are_content' %} +

     

    +
    +
    +
    + +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/letscowork.html b/digitalglarus/templates/letscowork.html similarity index 74% rename from digitalglarus/templates/digitalglarus/letscowork.html rename to digitalglarus/templates/letscowork.html index 518e1224..56f42cd6 100644 --- a/digitalglarus/templates/digitalglarus/letscowork.html +++ b/digitalglarus/templates/letscowork.html @@ -1,5 +1,5 @@ -{% extends "digitalglarus/base.html" %} -{% load staticfiles %} +{% extends "base_glarus.html" %} +{% load staticfiles cms_tags %} {% block title %}crowdfunding{% endblock %} {% block content %} @@ -18,34 +18,36 @@ + +

    -

    why - glarus? +

    + {% placeholder 'digitalglarus_why_glarus' %}


    -

    BEAUTIFUL - landscape +

    + {% placeholder 'digitalglarus_why_glarus_beautiful_landscape' %}

    -

    AFFORDABLE - price

    + {% placeholder 'digitalglarus_why_glarus_affordable_price' %} +
    -

    direct - connection to zurich + {% placeholder 'digitalglarus_why_glarus_direct_connection_zurich' %}

    + -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/digitalglarus/templates/digitalglarus/supporters.html b/digitalglarus/templates/supporters.html similarity index 97% rename from digitalglarus/templates/digitalglarus/supporters.html rename to digitalglarus/templates/supporters.html index 7f3df7e7..d4940435 100644 --- a/digitalglarus/templates/digitalglarus/supporters.html +++ b/digitalglarus/templates/supporters.html @@ -1,4 +1,4 @@ -{% extends "digitalglarus/base.html" %} +{% extends "base_glarus.html" %} {% load staticfiles %} {% block title %}About{% endblock %} diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index e7002d3f..cfd3452c 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -3,14 +3,9 @@ from django.conf.urls import url from . import views urlpatterns = [ - url(r'old^$', views.index, name='index'), - url(r'old_about$', views.about, name='about'), 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'support-us/?$', views.support, name='support'), - url(r'', views.index, name='index'), + url(r'support-us/?$', views.support, name='support'), # url(r'', views.index, name='index'), 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 cf355600..177be233 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -83,4 +83,4 @@ def supporters(request): context = { 'supporters': Supporter.objects.order_by('name') } - return render(request, 'digitalglarus/supporters.html', context) + return render(request, 'supporters.html', context) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 2e69a003..f6486c56 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -131,13 +131,14 @@ ROOT_URLCONF = 'dynamicweb.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ - os.path.join(PROJECT_DIR, 'membership/'), # membership template - os.path.join(PROJECT_DIR, 'templates/'), - os.path.join(PROJECT_DIR, 'templates/digitalglarus/partials'), - os.path.join(PROJECT_DIR, 'templates/cms'), - os.path.join(PROJECT_DIR, 'templates/digitalglarus'), - ], + 'DIRS': [os.path.join(PROJECT_DIR,'cms_templates/'), + os.path.join(PROJECT_DIR,'cms_templates/djangocms_blog/'), + os.path.join(PROJECT_DIR,'membership'), + os.path.join(PROJECT_DIR,'ungleich/templates/djangocms_blog/'), + os.path.join(PROJECT_DIR,'ungleich/templates/cms/ungleichch'), + os.path.join(PROJECT_DIR,'ungleich/templates/ungleich') + + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -158,11 +159,20 @@ TEMPLATES = [ WSGI_APPLICATION = 'dynamicweb.wsgi.application' -TDIR = os.path.join(PROJECT_DIR, 'templates') - -CMS_TEMPLATES_DIR = { - 1: os.path.join(TDIR, '') -} +CMS_TEMPLATES = ( + ('base_glarus.html', gettext('default')), + ('one_column.html', gettext('2 Column')), + ('two_columns.html', gettext('3 Column')), + ('about.html', gettext('DG.About')), + ('contact.html', gettext('DG.Contact')), + ('index.html', gettext('DG.Home')), + ('letscowork.html', gettext('DG.CoWork')), + # ('detail.html', gettext('DG.Detail')), + ('one_column.html', gettext('DG.OneColumn')), + #ungleich + ('blog_ungleich.html', gettext('Blog')), + ('page.html', gettext('Page')), +) DATABASES = { 'default': { diff --git a/dynamicweb/settings/prod.py b/dynamicweb/settings/prod.py index 3b385370..80a8d120 100644 --- a/dynamicweb/settings/prod.py +++ b/dynamicweb/settings/prod.py @@ -1,9 +1,10 @@ from .base import * -DEBUG = False +DEBUG = True ADMINS = ( ('Nico Schottelius', 'nico.schottelius@ungleich.ch'), + ('Raul Ascencio', 'raul.ascencio@yandex.com'), ) # ('Sanghee Kim', 'sanghee.kim@ungleich.ch'), diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index 7f06be82..1d5e5823 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -18,6 +18,8 @@ urlpatterns = [ # note the django CMS URLs included via i18n_patterns urlpatterns += i18n_patterns('', + url(r'^$',include('ungleich.urls')), + url(r'^blog/',include('ungleich.urls',namespace='ungleich')), url(r'^login/',include(membership_urls)), url(r'^admin/', include(admin.site.urls)), url(r'^digitalglarus/', include('digitalglarus.urls', diff --git a/membership/models.py b/membership/models.py index 4cb0ba6c..34390c45 100644 --- a/membership/models.py +++ b/membership/models.py @@ -101,7 +101,6 @@ class CustomUser(AbstractBaseUser): return self.email def has_perm(self, perm, obj=None): - print(perm) "Does the user have a specific permission?" # Simplest possible answer: Yes, always return True diff --git a/templates/__init__.py b/templates/__init__.py index eafdc433..44a1270e 100644 --- a/templates/__init__.py +++ b/templates/__init__.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -from django.utils.translation import ugettext_lazy as _ -TEMPLATES = { - 'digitalglarus/about.html': _('DG.About'), - 'digitalglarus/contact.html': _('DG.Contact'), - 'digitalglarus/index.html': _('DG.Home'), - 'digitalglarus/letscowork.html': _('DG.CoWork'), - 'digitalglarus/one_column.html': _('DG.OneColumn'), - 'ungleichch/blog.html': _('Blog'), - 'ungleichch/page.html': _('Page'), -} +# from django.utils.translation import ugettext_lazy as _ +# TEMPLATES = { +# 'digitalglarus/about.html': _('DG.About'), +# 'digitalglarus/contact.html': _('DG.Contact'), +# 'digitalglarus/index.html': _('DG.Home'), +# 'digitalglarus/letscowork.html': _('DG.CoWork'), +# 'digitalglarus/one_column.html': _('DG.OneColumn'), +# 'ungleichch/blog.html': _('Blog'), +# 'ungleichch/page.html': _('Page'), +# } diff --git a/templates/djangocms_blog/post_detail.html b/templates/djangocms_blog/post_detail.html deleted file mode 100644 index 82a5be02..00000000 --- a/templates/djangocms_blog/post_detail.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "glarus_blog/base.html" %} -{% load i18n thumbnail cms_tags %} - -{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} -{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %} -{% block canonical_url %} - {% endblock canonical_url %} -{% block title %}{{ post.get_title }}{% endblock %} - -{% block content_blog %}{% spaceless %} -
    - {% if post.main_image_id %} -
    - {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} - {{ post.main_image.default_alt_text }} -
    - {% endif %} -
    -
    -

    - - {{ post.title }} - - - {{ post.date_created }} - -

    -
    -{# {% block blog_meta %}#} -{# include "glarus_blog/includes/blog_meta.html"#} -{# {% endblock %}#} -
    -{% endspaceless %} -
    {% render_placeholder post.content %}
    -
    -{% endblock content_blog %} \ No newline at end of file diff --git a/templates/djangocms_blog/post_list.html b/templates/djangocms_blog/post_list.html deleted file mode 100644 index c062eae6..00000000 --- a/templates/djangocms_blog/post_list.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "glarus_blog/base.html" %} -{% load i18n thumbnail %}{% spaceless %} - -{% block canonical_url %}{% endblock canonical_url %} - -{% block content_blog %} -
    - {% block blog_title %} -
    -
    - {% endblock %} - {% for post in post_list %} - {% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} - {% empty %} -

    {% trans "No article found." %}

    - {% endfor %} - {% if author or archive_date or tagged_entries %} -

    {% trans "Back" %}

    - {% endif %} - {% if is_paginated %} - - {% endif %} -
    -{% endblock %} -{% endspaceless %} \ No newline at end of file diff --git a/ungleich/templates/cms/ungleichch/__init__.py b/ungleich/templates/cms/ungleichch/__init__.py index 403fbcc0..c2394ab6 100644 --- a/ungleich/templates/cms/ungleichch/__init__.py +++ b/ungleich/templates/cms/ungleichch/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ -TEMPLATES = { - 'blog.html': _('Blog'), - 'page.html': _('Page'), -} +# TEMPLATES = { +# 'blog_u.html': _('Blog'), +# 'page.html': _('Page'), +# } diff --git a/ungleich/templates/cms/ungleichch/_header_base.html b/ungleich/templates/cms/ungleichch/_header_base.html index 43e535f6..35e1973c 100644 --- a/ungleich/templates/cms/ungleichch/_header_base.html +++ b/ungleich/templates/cms/ungleichch/_header_base.html @@ -2,8 +2,8 @@
    {% block content_blog %}{% endblock %} -{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/templates/djangocms_blog/includes/blog_item.html b/ungleich/templates/ungleich/djangocms_blog/includes/blog_item.html similarity index 100% rename from templates/djangocms_blog/includes/blog_item.html rename to ungleich/templates/ungleich/djangocms_blog/includes/blog_item.html diff --git a/ungleich/templates/ungleich/djangocms_blog/post_detail.html b/ungleich/templates/ungleich/djangocms_blog/post_detail.html new file mode 100644 index 00000000..3139c71c --- /dev/null +++ b/ungleich/templates/ungleich/djangocms_blog/post_detail.html @@ -0,0 +1,49 @@ +{% extends "ungleich/djangocms_blog/base.html" %} +{% load i18n thumbnail cms_tags %} +{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} +{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %} +{% block canonical_url %}{% endblock canonical_url %} +{% block title %}{% page_attribute "page_title" %} - {{ post.get_title }}{% endblock %} + +{% block base_header %} +{% include "_header_post_detail.html" %} +{% endblock %} + +{% block content_blog %} +
    + {% if post.app_config.use_placeholder %} +
    {% render_placeholder post.content %}
    + {% else %} +
    {% render_model post "post_text" "post_text" %}
    + {% endif %} +
    +{% endblock content_blog %} +{#{% load i18n thumbnail cms_tags %}#} +{##} +{#{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}#} +{#{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %}#} +{#{% block canonical_url %}{% endblock canonical_url %}#} +{#{% block title %}{{ post.get_title }}{% endblock %}#} +{##} +{#{% block content_blog %}{% spaceless %}#} +{#
    #} +{#
    #} +{#

    {% render_model post "title" %}

    #} +{# {% block blog_meta %}#} +{# {% include "djangocms_blog/includes/blog_meta.html" %}#} +{# {% endblock %}#} +{#
    #} +{# {% if post.main_image_id %}#} +{#
    #} +{# {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %}#} +{# {{ post.main_image.default_alt_text }}#} +{#
    #} +{# {% endif %}#} +{# {% endspaceless %}#} +{# {% if post.app_config.use_placeholder %}#} +{#
    {% render_placeholder post.content %}
    #} +{# {% else %}#} +{#
    {% render_model post "post_text" "post_text" %}
    #} +{# {% endif %}#} +{#
    #} +{#{% endblock content_blog %}#} \ No newline at end of file diff --git a/ungleich/templates/ungleich/djangocms_blog/post_list_ungleich.html b/ungleich/templates/ungleich/djangocms_blog/post_list_ungleich.html new file mode 100644 index 00000000..e377fa90 --- /dev/null +++ b/ungleich/templates/ungleich/djangocms_blog/post_list_ungleich.html @@ -0,0 +1,90 @@ +{% extends "ungleich/djangocms_blog/base.html" %} +{% load i18n thumbnail %}{% spaceless %} + +{% block canonical_url %}{% endblock canonical_url %} + +{% block content_blog %} +
    + {% block blog_title %} +
    +

    + {% if author %}{% trans "Articles by" %} {{ author.get_full_name }} + {% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }} + {% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }} + {% elif category %}{% trans "Category" %} – {{ category }}{% endif %} +

    +
    + + {% endblock %} + {% for post in post_list %} + {% include "ungleich/djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} + {% empty %} +

    {% trans "No article found." %}

    + {% endfor %} + {% if author or archive_date or tagged_entries %} +

    {% trans "Back" %}

    + {% endif %} + {% if is_paginated %} + + + {% endif %} +
    +{% endblock %} +{% endspaceless %} + + +{#{% load i18n thumbnail %}{% spaceless %}#} +{##} +{#{% block canonical_url %}{% endblock canonical_url %}#} +{##} +{#{% block content_blog %}#} +{#
    #} +{# {% block blog_title %}#} +{#
    #} +{#

    #} +{# {% if author %}{% trans "Articles by" %} {{ author.get_full_name }}#} +{# {% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }}#} +{# {% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }}#} +{# {% elif category %}{% trans "Category" %} – {{ category }}{% endif %}#} +{#

    #} +{#
    #} +{# {% endblock %}#} +{# {% for post in post_list %}#} +{# {% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %}#} +{# {% empty %}#} +{#

    {% trans "No article found." %}

    #} +{# {% endfor %}#} +{# {% if author or archive_date or tagged_entries %}#} +{#

    {% trans "Back" %}

    #} +{# {% endif %}#} +{# {% if is_paginated %}#} +{# #} +{# {% endif %}#} +{#
    #} +{#{% endblock %}#} +{#{% endspaceless %}#} \ No newline at end of file diff --git a/ungleich/urls.py b/ungleich/urls.py new file mode 100644 index 00000000..8e768c6e --- /dev/null +++ b/ungleich/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import url +from . import views + +urlpatterns = [ + url(r'^$',views.PostListViewUngleich.as_view()), + # url(r'^$',views.PostListView.as_view()), + url(r'^(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P\w[-\w]*)/$',views.details) +] \ No newline at end of file diff --git a/ungleich/views.py b/ungleich/views.py index 91ea44a2..238632b5 100644 --- a/ungleich/views.py +++ b/ungleich/views.py @@ -1,3 +1,47 @@ from django.shortcuts import render +from django.utils.translation import get_language +from djangocms_blog.models import Post +from django.views.generic import ListView +from djangocms_blog.views import PostListView,BaseBlogView +from django.core.paginator import Paginator +from django.core.paginator import PageNotAnInteger +from django.core.paginator import EmptyPage +from djangocms_blog.settings import get_setting -# Create your views here. + +def blog(request): + posts = Post.objects.all() + print(posts) + context = { + 'post_list': posts + } + + # PostListView.base_template_name='post_list.html' + return render(request, 'ungleich/djangocms_blog/post_list_ungleich.html', context=context) + + +class PostListViewUngleich(PostListView): + model = Post + context_object_name = 'post_list' + base_template_name = 'post_list_ungleich.html' + paginate_by = 5 + + def get_context_data(self, **kwargs): + context = super(PostListView, self).get_context_data(**kwargs) + context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT') + return context + + def get_paginate_by(self, queryset): + return get_setting('PAGINATION') + + def get_queryset(self): + language = get_language() + queryset = self.model.objects.translated(language) + setattr(self.request, get_setting('CURRENT_NAMESPACE'), self.config) + return queryset + + +def details(request, year, month, day, slug): + post = Post.objects.translated(get_language(), slug=slug).first() + context = {'post': post} + return render(request, 'ungleich/djangocms_blog/post_detail.html', context=context)