Commits

Richard Shea committed 5c34533

Snapshotting dmochrtit progress

  • Participants
  • Parent commits 50f5fe3

Comments (0)

Files changed (3)

dcdemo/dcdemo/apps/dmochrtit/templates/dmochrtit/chart1.html

 <h1>Django-chartit Chart 1</h1>
 <head>
     <!-- code to include the highcharts and jQuery libraries goes here -->
-    <script src="{{ STATIC_URL }}dmochrtit/js/jquery-1.7.2.js" type="text/javascript"></script>
-    <script src="{{ STATIC_URL }}dmochrtit/js/highcharts/highcharts.js" type="text/javascript"></script>
+    <script src="/static/dmochrtit/js/jquery-1.7.2.js" type="text/javascript"></script>
+    <script src="/static/dmochrtit/js/highcharts/highcharts.js" type="text/javascript"></script>
     <!-- load_charts filter takes a comma-separated list of id's where -->
     <!-- the charts need to be rendered to                             -->
 </head>

dcdemo/dcdemo/apps/dmochrtit/views.py

 # Create your views here.
-from django.http import HttpResponse
+from django.http import HttpResponse 
+from django.shortcuts import render_to_response
 from django.template import RequestContext, loader
 
 from chartit import DataPool, Chart
 
+from ..dmodrv.models import WindObservation
+
 def index(request):
     template = loader.get_template('dmochrtit/index.html')
     context = RequestContext(request, {})
     return HttpResponse(template.render(context))
-def chart1(request):
+def chart1_old(request):
     chart = weather_chart_view(request)
     template = loader.get_template('dmochrtit/chart1.html')
     context = RequestContext(request, {})
     return HttpResponse(template.render(context))
 
 
-def weather_chart_view(request):
+def chart1(request):
+    template = loader.get_template('dmochrtit/chart1.html')
     #Step 1: Create a DataPool with the data we want to retrieve.
     weatherdata = \
-    DataPool(
-        series=
-        [{'options': {
-        'source': MonthlyWeatherByCity.objects.all()},
-        'terms': [
-        'month',
-        'houston_temp',
-        'boston_temp']}
-    ])
+        DataPool(
+            series=
+            [{'options': {
+            'source': WindObservation.objects.all()},
+            'terms': [
+            'when',
+            'speed']}
+        ])
 
     #Step 2: Create the Chart object
     cht = Chart(
             'type': 'line',
             'stacking': False},
             'terms':{
-            'month': [
-            'boston_temp',
-            'houston_temp']
+            'when': [
+            'speed']
             }}],
         chart_options =
             {'title': {
             'text': 'Month number'}}})
 
     #Step 3: Send the chart object to the template.
-    return render_to_response({'weatherchart': cht})
+    return render_to_response('dmochrtit/chart1.html', {'weatherchart': cht})
 
 

dcdemo/dcdemo/settings.py

 # Additional locations of static files
 PROJECT_DIR = os.path.dirname(__file__)
 STATICFILES_DIRS = (os.path.join(PROJECT_DIR, 'static'),)
+STATICFILES_DIRS = ()
 
 # List of finder classes that know how to find static files in
 # various locations.