Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/polls/views.py
diff options
context:
space:
mode:
authorRogelio Mita <rogeliomita@activitycentral.com>2013-09-04 19:27:54 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-09-04 19:27:54 (GMT)
commit6b98488a23caa7b4ca9d7484dedf0f2b6673292a (patch)
treead7227e6d67a3ea14fb99ac1d5b7926e98411c5f /webapp/polls/views.py
parentc6f62a5a3987b6e5f466f0603afdefa11a7e6a7f (diff)
Refactor: Timestamp for upload view
Diffstat (limited to 'webapp/polls/views.py')
-rw-r--r--webapp/polls/views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/webapp/polls/views.py b/webapp/polls/views.py
index b8efe96..d3b0fb4 100644
--- a/webapp/polls/views.py
+++ b/webapp/polls/views.py
@@ -3,6 +3,7 @@ import os
import json
import StringIO
import warnings
+from importlib import import_module
from datetime import datetime
@@ -29,6 +30,13 @@ from polls.forms import PollForm
from pollster.models import Pollster
+module_path = settings.CLOCK_CLASS.split('.')[:-1]
+module_path = ".".join(module_path)
+module = import_module(module_path)
+class_name = settings.CLOCK_CLASS.split('.')[-1:][0]
+Clock = getattr(module, class_name)
+
+
__all__ = [
'StructureFormView',
'PollFormView',
@@ -412,13 +420,14 @@ class UnploadPollResultFormView(TemplateView):
else:
# End validations
+ date_time_string = Clock().get_time_string()
uploaded_files = [
(f.name, f.temporary_file_path()) for f in files
]
for name, path in uploaded_files:
result_file = PollResultFile(path)
result_file.name = name
- result_file.set_upload_timestamp("31/12/1999 23:59hs")
+ result_file.set_upload_timestamp(date_time_string)
result_file.save()
processed_files = [file.name for file in files]