Ashley Felton  committed c11c862

log_date view.

  • Participants
  • Parent commits 06f5996
  • Branches default

Comments (0)

Files changed (3)

File temper/templates/index.html

 <!-- Main hero unit for a primary marketing message or call to action -->
 <div class="hero-unit">
     <h1>Hello, world!</h1>
+    <h2>{{ log_date }}</h2>
     <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
     <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>

File temper/

     # Open a file with today's date in /var/log/temps, write the temp to it.
     logfile = '/'.join([TEMP_LOGS, 'temps_{0}.log'.format(datetime.strftime(, '%Y%m%d'))])
     f = open(logfile, 'a')
-    f.write('{0},{1}\n'.format(datetime.utcnow().isoformat(), read_onewire_temp()))
+    f.write('{0},{1}\n'.format(datetime.strftime(, '%Y-%m-%dT%H:%M:%S'), read_onewire_temp()))

File temper/

 def index():
     temps_list = utils.read_log()
     return render_template('index.html')
+def log_date(year, month, day):
+    log_date = '{0}-{1}-{2}'.format(year, month, day)
+    log_date = datetime.strptime(log_date, '%Y-%m-%d')
+    return render_template('index.html', log_date=log_date)