Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
properly integrate into website and put live
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Nov 14, 2013
1 parent a3e207a commit d59d490
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
27 changes: 27 additions & 0 deletions pages/views.py
@@ -1,8 +1,11 @@
# Create your views here.

from django.template.response import TemplateResponse

import shogun.settings as settings
import util.notebook
import util.demo
import util.matrix

from django.http import HttpResponse,Http404

Expand Down Expand Up @@ -235,6 +238,30 @@ def irclogs(request):
'irclogfiles' : all_entries,
'news' : news})))

def matrix(request):
allpages = Page.objects.order_by('sort_order')
news = get_news()[0]
allsubpages=[]

try:
parent_subpages = Subpage.objects.filter(rootpage__path__exact='features', is_top=True).order_by('sort_order')
except:
parent_subpages = None

current_parent=None
details={'current_page_path' : 'features',
'current_subpage_path' : 'matrix',
'all_pages' : allpages,
'all_subpages' : allsubpages,
'parent_subpages' : parent_subpages,
'current_parent' : current_parent,
'news' : news,
'table' : util.matrix.get_matrix(),
'related' : util.matrix.get_related_projects()
}

return TemplateResponse(request, 'matrix.html', details)

def demo(request):
try:
template = get_template("notebooks.html")
Expand Down
2 changes: 1 addition & 1 deletion shogun/urls.py
Expand Up @@ -17,7 +17,7 @@

# Other urls:

url(r'^page/features', 'util.matrix.display_matrix'),
url(r'^page/features', 'pages.views.matrix'),

# Notebooks
url(r'^notebooks/list', 'util.export.list_notebooks'),
Expand Down
7 changes: 4 additions & 3 deletions util/matrix.py
@@ -1,4 +1,3 @@
from django.http import HttpResponse,Http404
from django.template.response import TemplateResponse
from shogun.settings import MATRIX_FILE

Expand All @@ -9,7 +8,8 @@ def fetch_spreadsheet():
csv = f.read()
file(MATRIX_FILE,'w').write(csv)

def display_matrix(request):

def get_matrix():
j=0
table=[]
for l in file(MATRIX_FILE).readlines():
Expand Down Expand Up @@ -52,7 +52,8 @@ def display_matrix(request):
else:
table.append("%s</td><td>" % i)
table.append("%s</td></tr><tr><td>" % s2[-1])
return TemplateResponse(request, 'matrix.html', {'table': ''.join(table), 'related' : get_related_projects() })

return ''.join(table)


def get_related_projects():
Expand Down

0 comments on commit d59d490

Please sign in to comment.