From 9b48d37674e7ef44e84811b27566a1cf877f0b6f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 14 May 2015 01:24:40 +0200 Subject: [PATCH] postgres module Signed-off-by: Nico Schottelius --- digital_glarus/views.py | 7 ++++--- dynamicweb/settings.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/digital_glarus/views.py b/digital_glarus/views.py index 18e72e43..fd1f2117 100644 --- a/digital_glarus/views.py +++ b/digital_glarus/views.py @@ -27,15 +27,16 @@ def index(request): return render(request, 'digital_glarus/index.html') def contact(request): + message = Message(received_date=datetime.datetime.now()) + form = MessageForm(request.POST, instance=message) + if request.method == 'POST': - message = Message(received_date=datetime.datetime.now()) - form = MessageForm(request.POST, instance=message) if form.is_valid(): form.save() return HttpResponseRedirect(reverse("digital_glarus:contact")) - form = MessageForm() + # form = MessageForm() context = { 'form': form, diff --git a/dynamicweb/settings.py b/dynamicweb/settings.py index c94e3b8b..01f4c626 100644 --- a/dynamicweb/settings.py +++ b/dynamicweb/settings.py @@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os +import django.db.backends.postgresql_psycopg2 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))