1. Frederic De Groef
  2. csxj_viewer_app

Commits

Frederic De Groef  committed 5d40716

show some graphs

  • Participants
  • Parent commits 95a6eec
  • Branches default
  • Tags v0.4.0

Comments (0)

Files changed (3)

File provider/templates/source_list.html

View file
              {% endwith %}
 
             <br/><br/>
-            <a href="/source/{{ source_name }}"> Go browse them. </a>
+            You can <a href="/source/{{ source_name }}"> browse</a> them,. <br/><br/>
+            Or even look at
+            <a href='/source/{{source_name  }}/graphs'>pretty graphs</a> about them.
+        
 
         </div>
 

File provider/urls.py

View file
 urlpatterns = patterns('',
                        url(r'^(.*)/(\d\d\d\d)-(\d\d)-(\d\d)/(\d\d).(\d\d).(\d\d)$', 'provider.views.show_source_day_batch_summary'),
                        url(r'^(.*)/(\d\d\d\d)-(\d\d)-(\d\d)$', 'provider.views.show_source_day_summary'),
+                       url(r'^(.*)/graphs$', 'provider.views.show_source_graphs'),
                        url(r'^(.+)$', 'provider.views.show_source_summary'),
                        url(r'^$', 'provider.views.index'),)
 

File provider/views.py

View file
         else:
             return render_not_found('There is no data to show you for that date : ' + datetime(y,m,d).strftime('%B %d, %Y'))
     else:
-        return render_not_found('There is no content provider with that id : {0}'.format(source_name))
+        return render_not_found('There is no content provider with that id : {0}'.format(source_name))
+
+
+
+def show_source_graphs(request, source_name):
+    available_sources = jsondb.get_source_list(STATIC_DATA_PATH)
+    if source_name in available_sources:
+        values = base_template.load_all_common_values(STATIC_DATA_PATH)
+        values.update({'source_name':source_name})
+
+        t = loader.get_template('source_graphs.html')
+        c = Context(values)
+        return HttpResponse(t.render(c))
+    else:
+        return render_not_found('There is no content provider with that id : {0}'.format(source_name))