aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/news.py16
-rwxr-xr-xwqflask/wqflask/templates/news.html21
-rwxr-xr-xwqflask/wqflask/views.py13
3 files changed, 41 insertions, 9 deletions
diff --git a/wqflask/wqflask/news.py b/wqflask/wqflask/news.py
new file mode 100755
index 00000000..62dc1bbb
--- /dev/null
+++ b/wqflask/wqflask/news.py
@@ -0,0 +1,16 @@
+from __future__ import absolute_import, print_function, division
+import sys
+reload(sys)
+sys.setdefaultencoding('utf8')
+from flask import g
+
+class News(object):
+
+ def __init__(self):
+ sql = """
+ SELECT News.id, News.date, News.details
+ FROM News
+ order by News.date desc
+ """
+ self.title = "GeneNetwork News"
+ self.newslist = g.db.execute(sql).fetchall()
diff --git a/wqflask/wqflask/templates/news.html b/wqflask/wqflask/templates/news.html
new file mode 100755
index 00000000..0a19dcee
--- /dev/null
+++ b/wqflask/wqflask/templates/news.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+
+{% block title %}{{title}}{% endblock %}
+
+{% block content %}
+<div class="container">
+ <h3>{{title}}</h3>
+ <table class="table table-hover table-striped">
+ <tbody>
+ {% for newsitem in newslist %}
+ <tr>
+ <td style="width: 100px;">
+ <span style="font-weight: bold;">{{newsitem.date}}</span>
+ </td>
+ <td>{{newsitem.details|safe}}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index deb566ba..7c0f4e14 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -30,6 +30,7 @@ from flask import (render_template, request, make_response, Response,
from wqflask import search_results
from wqflask import docs
+from wqflask import news
from base.data_set import DataSet # Used by YAML in marker_regression
from base.data_set import create_datasets_list
from wqflask.show_trait import show_trait
@@ -145,15 +146,9 @@ def help():
return render_template("docs.html", **doc.__dict__)
@app.route("/news")
-def news():
- #variables = whats_new.whats_new()
- with open("/home/sam/gene/wqflask/wqflask/yaml_data/whats_new.yaml") as fh:
- contents = fh.read()
- yamilized = yaml.safe_load(contents)
- news_items = yamilized['news']
- for news_item in news_items:
- print("\nnews_item is: %s\n" % (news_item))
- return render_template("whats_new.html", news_items=news_items)
+def news_route():
+ newsobject = news.News()
+ return render_template("news.html", **newsobject.__dict__)
@app.route("/references")
def references():