Merge branch 'develop'

This commit is contained in:
rascencio 2016-04-09 19:56:45 +02:00
commit 08019b9d33
17 changed files with 260 additions and 86 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
db.sqlite3 db.sqlite3
*.pyc *.pyc
*.DS_Store
build/ build/
dist/ dist/
*.egg_info *.egg_info

26
digitalglarus/forms.py Normal file
View file

@ -0,0 +1,26 @@
from django import forms
from .models import Message
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
class ContactUsForm(forms.ModelForm):
error_css_class = 'autofocus'
class Meta:
model = Message
fields = ['name', 'email', 'phone_number', 'message']
widgets = {
'name': forms.TextInput(attrs={'class': u'form-control'}),
'email': forms.TextInput(attrs={'class': u'form-control'}),
'phone_number': forms.TextInput(attrs={'class': u'form-control'}),
'message': forms.Textarea(attrs={'class': u'form-control'}),
}
def send_email(self):
text_content = render_to_string('emails/contact.txt', {'data': self.cleaned_data})
html_content = render_to_string('emails/contact.html', {'data': self.cleaned_data})
email = EmailMultiAlternatives('Subject', text_content)
email.attach_alternative(html_content, "text/html")
email.to = ['info@digitalglarus.ch']
email.send()

Binary file not shown.

View file

@ -0,0 +1,43 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-09 02:43-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:9
msgid "Digital Glarus Gallery"
msgstr ""
#: cms_plugins.py:21
msgid "Digital Glarus Supporters"
msgstr ""
#: urls.py:8
msgid "contact/?$"
msgstr "kontakt/?$"
#: urls.py:9
msgid "supporters/?$"
msgstr "befurworter/?$"
#: urls.py:10
msgid "support-us/?$"
msgstr ""
#: views.py:23
msgid "Message Successfully Sent"
msgstr ""

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-07 05:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('digitalglarus', '0004_dggallery_dggalleryplugin_dgpicture_dgsupportersplugin_supporter'),
]
operations = [
migrations.AlterField(
model_name='message',
name='received_date',
field=models.DateTimeField(auto_now_add=True),
),
]

View file

@ -8,8 +8,7 @@ class Message(models.Model):
email = models.EmailField() email = models.EmailField()
phone_number = models.CharField(max_length=200) phone_number = models.CharField(max_length=200)
message = models.TextField() message = models.TextField()
received_date = models.DateTimeField(auto_now_add=True)
received_date = models.DateTimeField('date received')
def __str__(self): def __str__(self):
return "%s - %s - %s" % (self.name, self.email, self.received_date) return "%s - %s - %s" % (self.name, self.email, self.received_date)
@ -26,6 +25,7 @@ class Supporter(models.Model):
return reverse('dgSupporters_view', args=[self.pk]) 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)
name = models.CharField(max_length=30) name = models.CharField(max_length=30)

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 KiB

View file

@ -109,7 +109,7 @@
<div class="row"> <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<p class="text-center">Copyright &copy; <a href="http://www.ungleich.ch">ungleich GmbH <p class="text-center">Copyright &copy; <a href="http://www.ungleich.ch">ungleich GmbH
2015</a></p> {% now "Y" %}</a></p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -6,17 +6,26 @@
<div class="row"> <div class="row">
<div class="box"> <div class="box">
<div class="col-lg-12"> <div class="col-lg-12">
{% for message in messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>{{ message }}</strong>
</div>
{% endfor %}
<hr> <hr>
<h2 class="intro-text text-center"> <h2 class="intro-text text-center">
{% placeholder 'digital_glarus_contact' %} {% static_placeholder "digital_glarus_contact_title" %}
</h2> </h2>
<hr> <hr>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{% placeholder 'digital_glarus_contact_content' %} <p>
{% static_placeholder "digital_glarus_contact_location" %}
</p>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{% placeholder 'digital_glarus_contact_information' %} {% static_placeholder "digital_glarus_contact_information" %}
<div class="clearfix">&nbsp;</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@ -26,40 +35,45 @@
<div class="box"> <div class="box">
<div class="col-lg-12"> <div class="col-lg-12">
<hr> <hr>
<h2 class="intro-text text-center">Contact <h2 class="intro-text text-center">
<strong>form</strong> {% static_placeholder "digital_glarus_contact_form_title" %}
</h2> </h2>
<hr> <hr>
<p>If you want further information on Digital Glarus, please send us a message using the form below.</p> <p>{% static_placeholder "digital_glarus_contact_form_text" %}</p>
<form action="{% url 'digitalglarus:contact' %}" method="post" role="form"> <form action="" method="post" >
{% csrf_token %} {% csrf_token %}
<div class="row"> <div class="row">
<div class="form-group col-lg-4"> <div autofocus class="form-group col-lg-4 {% if form.name.errors %}has-error text-danger{% endif %}">
<label>Name</label> {{ form.name.label_tag }}
<input type="text" class="form-control" name="name"> {{ form.name }}
{{ form.name.errors|striptags}}
</div> </div>
<div class="form-group col-lg-4"> <div class="form-group col-lg-4 {% if form.email.errors %}has-error text-danger {% endif %}">
<label>Email Address</label> {{ form.email.label_tag }}
<input type="email" class="form-control" name="email"> {{ form.email }}
{{ form.email.errors|striptags}}
</div> </div>
<div class="form-group col-lg-4"> <div class="form-group col-lg-4 {% if form.phone_number.errors %}has-error text-danger {% endif %}">
<label>Phone Number</label> {{ form.phone_number.label_tag }}
<input type="tel" class="form-control" name="phone_number"> {{ form.phone_number }}
{{ form.phone_number.errors|striptags}}
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="form-group col-lg-12"> <div class="form-group col-lg-12 {% if form.message.errors %}has-error text-danger {% endif %}">
<label>Message</label> {{ form.message.label_tag }}
<textarea class="form-control" rows="6" name="message"></textarea> {{ form.message }}
{{ form.message.errors|striptags}}
</div> </div>
{{ form.non_field_errors }}
<div class="form-group col-lg-12"> <div class="form-group col-lg-12">
<input type="hidden" name="save" value="contact"> <input type="hidden" name="save" value="contact">
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default" {% if form.name.errors %} autofocus {% endif %}>Submit</button>
</div> </div>
</div> </div>
</form> </form>
<!-- -->
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- /.container --> <!-- /.container -->
{% endblock %} {% endblock %}

View file

@ -0,0 +1,15 @@
<<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
Name:{{data.name}}<br/>
Email:{{data.email}}<br/>
Phone number:{{data.phone_number}}<br/>
Message:{{data.message}}<br/>
</body>
</html>

View file

@ -0,0 +1,15 @@
<<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
Name:{{data.name}}<br/>
Email:{{data.email}}<br/>
Phone number:{{data.phone_number}}<br/>
Message:{{data.message}}<br/>
</body>
</html>

View file

@ -0,0 +1,24 @@
{% extends "base_glarus.html" %}
{% load staticfiles %}
{% load cms_tags %}
{% block title %}About{% endblock %}
{% block content %}
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="text-center">
{% static_placeholder "digital_glarus_supporters_become_supporter" %}
</h2>
<hr>
</div>
<div class="col-md-7 col-md-offset-3">
{% static_placeholder "digital_glarus_support_info" %}
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- /.container -->
{% endblock %}

View file

@ -1,28 +1,35 @@
{% extends "base_glarus.html" %} {% extends "base_glarus.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load cms_tags %}
{% block title %}About{% endblock %} {% block title %}About{% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="box"> <div class="box">
<img class="img-responsive img-full" src="{% static 'digitalglarus/img/thank-you.png' %}" alt="">
<div class="col-lg-12"> <div class="col-lg-12">
<hr> <hr>
<h2 class="intro-text text-center"> <h2 class="text-center">
Supporters {% static_placeholder "digital_glarus_supporters_title" %}
</h2> </h2>
<hr> <hr>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="text-center">
{% static_placeholder "digital_glarus_supporters_info" %}
</div>
</div>
<div class="col-md-12">
<div class="text-center">
{% for supporter in supporters %} {% for supporter in supporters %}
<div class="col-md-6">
<div class="thumbnail">
<div class="caption"> <div class="caption">
<h3>{{supporter.name}}</h3> <h3>{{supporter.name}}</h3>
<p>{{supporter.description}}</p>
</div>
</div>
</div> </div>
{% endfor %} {% endfor %}
<hr>
<a class="btn btn-default" href="{% url 'digitalglarus:support' %}" role="button">{% static_placeholder "digital_glarus_supporters_become_supporter" %}</a>
</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>

View file

@ -1,11 +1,13 @@
from django.conf.urls import url from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from . import views from . import views
from .views import ContactView
urlpatterns = [ urlpatterns = [
url(r'old_contact$', views.contact, name='contact'), url(_(r'contact/?$'), ContactView.as_view(), name='contact'),
url(r'supporters/$', views.supporters, name='supporters'), url(_(r'supporters/?$'), views.supporters, name='supporters'),
# url(r'', views.index, name='index'), url(_(r'support-us/?$'), views.support, name='support'),
url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'), url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
url(r'blog/$',views.blog,name='blog'), url(r'blog/$', views.blog, name='blog'),
] ]

View file

@ -7,14 +7,26 @@ from django.core.urlresolvers import reverse
from django.utils.translation import get_language from django.utils.translation import get_language
from djangocms_blog.models import Post from djangocms_blog.models import Post
from django.core.urlresolvers import resolve from django.core.urlresolvers import resolve
from django.contrib import messages
from django.utils.translation import ugettext as _
from .models import Message, Supporter from .models import Message, Supporter
from .forms import ContactUsForm
from django.views.generic.edit import FormView
class MessageForm(ModelForm):
required_css_class = 'form-control' class ContactView(FormView):
class Meta: template_name = 'contact.html'
model = Message form_class = ContactUsForm
fields = ['name', 'email', 'phone_number', 'message' ] success_url = '/digitalglarus/contact/'
success_message = _('Message Successfully Sent')
def form_valid(self, form):
form.save()
form.send_email()
messages.add_message(self.request, messages.SUCCESS, self.success_message)
return super(ContactView, self).form_valid(form)
def detail(request, message_id): def detail(request, message_id):
@ -41,24 +53,6 @@ def home(request):
def letscowork(request): def letscowork(request):
return render(request, 'digitalglarus/letscowork.html') return render(request, 'digitalglarus/letscowork.html')
def contact(request):
message = Message(received_date=datetime.datetime.now())
form = MessageForm(request.POST, instance=message)
if request.method == 'POST':
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse("digitalglarus:contact"))
# form = MessageForm()
context = {
'form': form,
}
return render(request, 'digitalglarus/contact.html', context)
def blog(request): def blog(request):
tags = ["digitalglarus"] tags = ["digitalglarus"]
@ -80,6 +74,10 @@ def blog_detail(request, slug):
return render(request, 'glarus_blog/post_detail.html', context) return render(request, 'glarus_blog/post_detail.html', context)
def support(request):
return render(request, 'support.html')
def supporters(request): def supporters(request):
context = { context = {
'supporters': Supporter.objects.order_by('name') 'supporters': Supporter.objects.order_by('name')

View file

@ -82,18 +82,18 @@ INSTALLED_APPS = (
'djangocms_file', 'djangocms_file',
'djangocms_picture', 'djangocms_picture',
'djangocms_video', 'djangocms_video',
'djangocms_flash', # 'djangocms_flash',
'djangocms_googlemap', # 'djangocms_googlemap',
'djangocms_inherit', # 'djangocms_inherit',
'djangocms_link', # 'djangocms_link',
'djangocms_teaser', # 'djangocms_teaser',
'djangocms_page_meta', 'djangocms_page_meta',
'djangocms_text_ckeditor', 'djangocms_text_ckeditor',
'djangocms_admin_style', 'djangocms_admin_style',
'cmsplugin_filer_file', 'cmsplugin_filer_file',
'cmsplugin_filer_folder', 'cmsplugin_filer_folder',
'cmsplugin_filer_link', 'cmsplugin_filer_link',
'cmsplugin_filer_teaser', # 'cmsplugin_filer_teaser',
'cmsplugin_filer_video', 'cmsplugin_filer_video',
# #
#blog #blog
@ -178,6 +178,9 @@ DATABASES = {
} }
} }
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/ # https://docs.djangoproject.com/en/1.7/topics/i18n/
@ -196,6 +199,11 @@ LANGUAGES = (
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
LOCALE_PATHS = [
os.path.join(PROJECT_DIR,'digitalglarus/locale'),
]
CMS_PLACEHOLDER_CONF = { CMS_PLACEHOLDER_CONF = {
'logo_image': { 'logo_image': {
'name': 'Logo Image', 'name': 'Logo Image',

View file

@ -1,9 +1,10 @@
from .base import * from .base import *
DEBUG = False DEBUG = True
ADMINS = ( ADMINS = (
('Nico Schottelius', 'nico.schottelius@ungleich.ch'), ('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
('Raul Ascencio', 'raul.ascencio@yandex.com'),
) )
# ('Sanghee Kim', 'sanghee.kim@ungleich.ch'), # ('Sanghee Kim', 'sanghee.kim@ungleich.ch'),