From 10d3e236ee894f560eee3dacc033ec7a725f3b47 Mon Sep 17 00:00:00 2001 From: Tomislav R Date: Sat, 9 Apr 2016 08:51:20 +0200 Subject: [PATCH] home added and assigned right template --- cms_templates/home_digitalglarus.html | 99 +++++++++++++++++++ digitalglarus/templates/base_glarus.html | 9 +- .../glarus_blog/includes/blog_item.html | 60 +++++------ .../templates/glarus_blog/post_detail.html | 2 +- .../templates/glarus_blog/post_list.html | 2 +- digitalglarus/urls.py | 2 +- digitalglarus/views.py | 7 +- dynamicweb/settings/base.py | 5 +- dynamicweb/urls.py | 2 +- ungleich/templates/cms/ungleichch/index.html | 2 +- ungleich/urls.py | 1 + ungleich/views.py | 7 +- 12 files changed, 156 insertions(+), 42 deletions(-) create mode 100644 cms_templates/home_digitalglarus.html diff --git a/cms_templates/home_digitalglarus.html b/cms_templates/home_digitalglarus.html new file mode 100644 index 00000000..d7894fb2 --- /dev/null +++ b/cms_templates/home_digitalglarus.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/base_glarus.html b/digitalglarus/templates/base_glarus.html index 50b7e471..54eefe42 100644 --- a/digitalglarus/templates/base_glarus.html +++ b/digitalglarus/templates/base_glarus.html @@ -80,11 +80,18 @@ diff --git a/digitalglarus/templates/glarus_blog/includes/blog_item.html b/digitalglarus/templates/glarus_blog/includes/blog_item.html index 667c0111..94d1c009 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_item.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_item.html @@ -1,32 +1,34 @@ {% load i18n thumbnail %}
- {% 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 }} -

-
- + {% 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 }} +

+
+
\ 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 807fad33..dd919da9 100644 --- a/digitalglarus/templates/glarus_blog/post_detail.html +++ b/digitalglarus/templates/glarus_blog/post_detail.html @@ -1,4 +1,4 @@ -{% extends "base_glarus.html" %} +{% extends "base.html" %} {% load i18n thumbnail cms_tags %} {% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} diff --git a/digitalglarus/templates/glarus_blog/post_list.html b/digitalglarus/templates/glarus_blog/post_list.html index cfd90d3e..c062eae6 100644 --- a/digitalglarus/templates/glarus_blog/post_list.html +++ b/digitalglarus/templates/glarus_blog/post_list.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "glarus_blog/base.html" %} {% load i18n thumbnail %}{% spaceless %} {% block canonical_url %}{% endblock canonical_url %} diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index 9e7e6002..346b465f 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -6,6 +6,6 @@ urlpatterns = [ url(r'old_contact$', views.contact, name='contact'), url(r'supporters/$', views.supporters, name='supporters'), # 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'), + url(r'blog/$',views.blog,name='blog'), ] diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 3fe04e88..a06bc1ef 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -70,11 +70,14 @@ def blog(request): def blog_detail(request, slug): - post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first() + # post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first() + language = 'en-us' # currently nothing is translated to german so we give then en + + post = Post.objects.translated(language, slug=slug).first() context = { 'post': post, } - return render(request, 'post_detail.html', context) + return render(request, 'glarus_blog/post_detail.html', context) def supporters(request): diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index f6486c56..89062f70 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -27,9 +27,6 @@ PROJECT_DIR = os.path.abspath( # load .env file dotenv.read_dotenv("{0}/.env".format(PROJECT_DIR)) -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ - SITE_ID = 1 APP_ROOT_ENDPOINT = "/" @@ -165,7 +162,7 @@ CMS_TEMPLATES = ( ('two_columns.html', gettext('3 Column')), ('about.html', gettext('DG.About')), ('contact.html', gettext('DG.Contact')), - ('index.html', gettext('DG.Home')), + ('home_digitalglarus.html', gettext('DG.Home')), ('letscowork.html', gettext('DG.CoWork')), # ('detail.html', gettext('DG.Detail')), ('one_column.html', gettext('DG.OneColumn')), diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index 1d5e5823..fe2054ce 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -18,7 +18,7 @@ urlpatterns = [ # note the django CMS URLs included via i18n_patterns urlpatterns += i18n_patterns('', - url(r'^$',include('ungleich.urls')), + # 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)), diff --git a/ungleich/templates/cms/ungleichch/index.html b/ungleich/templates/cms/ungleichch/index.html index 8fd5fde8..f8b86001 100644 --- a/ungleich/templates/cms/ungleichch/index.html +++ b/ungleich/templates/cms/ungleichch/index.html @@ -1,3 +1,3 @@ -{% extends "base_ungleich.html" %} +{% extends "base_glarus.html" %} {% block base_content %} {% endblock %} diff --git a/ungleich/urls.py b/ungleich/urls.py index 8e768c6e..8004657e 100644 --- a/ungleich/urls.py +++ b/ungleich/urls.py @@ -5,4 +5,5 @@ 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 238632b5..1970e54b 100644 --- a/ungleich/views.py +++ b/ungleich/views.py @@ -42,6 +42,11 @@ class PostListViewUngleich(PostListView): def details(request, year, month, day, slug): - post = Post.objects.translated(get_language(), slug=slug).first() + #should be this way + language = get_language() + #but currently the posts are not trasnlated + # language = 'en-us' + post = Post.objects.translated(language, slug=slug).first() context = {'post': post} return render(request, 'ungleich/djangocms_blog/post_detail.html', context=context) +