diff --git a/VIPSWeb/local_settings_sample.py b/VIPSWeb/local_settings_sample.py index 124b53b16809e2db79da417009a76616cde84f43..29387183706a25941ba739334c236fcc014fd49a 100644 --- a/VIPSWeb/local_settings_sample.py +++ b/VIPSWeb/local_settings_sample.py @@ -87,7 +87,8 @@ VIPSCOREMANAGER_SERVER_NAME = "vipscoremanager" # Set to none if using certificate signed by a CA #VIPSCOREMANAGER_SSLCERT_PATH ="/path/to/myselfsignedcertificate.crt" VIPSCOREMANAGER_SSLCERT_PATH = None - +# Date format for dates from VIPSLogic +VIPSLOGIC_DATE_FORMAT = "%Y-%m-%d" # Site owner info SITE_OWNER_NAME = "FooBar Inc" diff --git a/VIPSWeb/views.py b/VIPSWeb/views.py index 318b8cafa4bb11c5b18806a320190fa4a9ceff7f..f7e1dd2b7e00fd92f2755a86ff0d53ab211432e1 100644 --- a/VIPSWeb/views.py +++ b/VIPSWeb/views.py @@ -25,7 +25,7 @@ def index(request): messages_by_tag = {} for message_tag_id in settings.FRONTPAGE_MESSAGE_TAG_IDS: messages = Message.get_messages_by_tag(message_tag_id) - print "MESSAGES: %s" % messages + #print "MESSAGES: %s" % messages messages_by_tag[message_tag_id] = messages #for message in messages: # print message diff --git a/messages/models.py b/messages/models.py index 2f325fe7ce7c99bf55f8bebc7ba4e7e1692b50b9..222c063b4f415ac23fc33337f1f469527e388b51 100644 --- a/messages/models.py +++ b/messages/models.py @@ -17,6 +17,7 @@ import requests from django.conf import settings +from datetime import datetime class MessageTag: def __init__(self, @@ -122,14 +123,15 @@ class Message: def get_instance_from_dict(the_dict): message_locale = Message.get_message_locale(the_dict["messageLocaleSet"], settings.VIPSLOGIC_LANGUAGE_CODE) message_illustration = Message.get_illustration(the_dict["messageIllustrationSet"], settings.VIPSLOGIC_LANGUAGE_CODE) + print the_dict["datePub"] return Message( the_dict["messageId"], the_dict["organizationId"], message_locale.get("heading","MISSING HEADING FOR LOCALE '%s'" % settings.VIPSLOGIC_LANGUAGE_CODE), message_locale.get("leadParagraph","MISSING LEAD PARAGRAPH FOR LOCALE '%s'" % settings.VIPSLOGIC_LANGUAGE_CODE), message_locale.get("body","MISSING BODY TEXT FOR LOCALE '%s'" % settings.VIPSLOGIC_LANGUAGE_CODE), - the_dict["datePub"], - the_dict["dateValidTo"], + datetime.strptime(the_dict["datePub"],settings.VIPSLOGIC_DATE_FORMAT) , + datetime.strptime(the_dict["dateValidTo"],settings.VIPSLOGIC_DATE_FORMAT), message_illustration.get("file_name", None), message_illustration.get("caption", None) )