Commits

Richard Shea committed d65eef7

Committing the ChartIt work to date before I move off onto the other
libraries

Comments (0)

Files changed (3)

  - Add template for use by `index` method to host application.
 
 
+Relevant Defects:
+https://github.com/pgollakota/django-chartit/issues/8
+https://github.com/pgollakota/django-chartit/issues/12
+
+
 
 

dcdemo/dcdemo/apps/dmochrtit/views.py

             [{'options': {
             'source': WindObservation.objects.all()},
             'terms': [
-            'when',
+            'when_iso',
             'speed']}
         ])
 
             'type': 'line',
             'stacking': False},
             'terms':{
-            'when': [
+            'when_iso': [
             'speed']
             }}],
         chart_options =

dcdemo/dcdemo/apps/dmodrv/models.py

     when = models.DateTimeField()
     speed = models.DecimalField("speed (km/h)", default=0, max_digits=6, decimal_places=3)
     direction = models.IntegerField("direction", default=0)
+
+    def _when_iso(self):
+        "Returns the `when` property formatted as an ISO date"
+        return str(self.when)
+
+    when_iso = property(_when_iso)
+
     def __str__(self):
         return "%s %s" % \
             (self.station.name, self.when)