Skip to content

Commit

Permalink
Merge pull request #25 from tu-nv/master
Browse files Browse the repository at this point in the history
Fix missing templates
  • Loading branch information
caesar2164 authored Feb 16, 2019
2 parents 34cef82 + 142539f commit 9fa18d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
from setuptools import setup
from setuptools.command.test import test as TestCommand

def package_data(pkg, root):
def package_data(pkg, roots):
"""Generic function to find package_data for `pkg` under `root`."""
data = []
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))
for root in roots:
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))

return {pkg: data}

Expand Down Expand Up @@ -45,7 +46,7 @@ def run_tests(self):

setup(
name='xblock-submit-and-compare',
version='0.6.2',
version='0.7.0',
description='Submit and Compare XBlock for self assessment',
packages=[
'submit_and_compare',
Expand All @@ -70,7 +71,7 @@ def run_tests(self):
package_dir={
'submit_and_compare': 'submit_and_compare',
},
package_data=package_data("submit_and_compare", "static"),
package_data=package_data("submit_and_compare", ['static', 'templates']),
classifiers=[
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Intended Audience :: Developers',
Expand Down
10 changes: 6 additions & 4 deletions submit_and_compare/submit_and_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
from lxml import etree

from django.template import Context, Template
from django.template.loader import get_template
from django.utils.translation import ungettext

from xblock.core import XBlock
from xblock.fields import Scope, String, List, Float, Integer
from xblock.fragment import Fragment
from xblockutils.resources import ResourceLoader

from .mixins import EnforceDueDates

LOG = logging.getLogger(__name__)

loader = ResourceLoader(__name__)


# Public
def get_body(xmlstring):
Expand Down Expand Up @@ -245,9 +247,9 @@ def student_view(self, context=None):
'is_past_due': self.is_past_due(),
}
)
template = get_template('submit_and_compare_view.html')
fragment = self.build_fragment(
template,
fragment = Fragment()
fragment.content = loader.render_template(
'templates/submit_and_compare_view.html',
context
)
fragment.add_css(
Expand Down

0 comments on commit 9fa18d5

Please sign in to comment.