Skip to content

Commit

Permalink
Merge pull request #17 from arjunc77/context_data
Browse files Browse the repository at this point in the history
use kwargs to get context data for the rendered graph
  • Loading branch information
shabda committed Mar 13, 2014
2 parents 2b0d55e + 6aa7668 commit 1485a98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo_project/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Markdown==2.3.1
Sphinx==1.2b1
docutils==0.11
numpy==1.7.1
matplotlib==1.3.0
matplotlib==1.3.1
pymongo==2.5.1
pyparsing==2.0.1
python-dateutil==1.5
Expand Down
4 changes: 4 additions & 0 deletions graphos/renderers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, data_source, html_id=None,
self.width = width or DEFAULT_WIDTH
self.options = options or {}
self.header = data_source.get_header()
self.context_data = kwargs

def get_data(self):
return self.data_source.get_data()
Expand All @@ -38,6 +39,9 @@ def get_template(self):
def get_html_id(self):
return self.html_id

def get_context_data(self):
return self.context_data

def as_html(self):
context = {"chart": self}
return render_to_string(self.get_template(), context)

0 comments on commit 1485a98

Please sign in to comment.