Commit 62059b58 by Ehtesham

conditionally adding response_data in context

parent 5058e42e
...@@ -224,8 +224,8 @@ class InputTypeBase(object): ...@@ -224,8 +224,8 @@ class InputTypeBase(object):
self.hint = feedback.get('hint', '') self.hint = feedback.get('hint', '')
self.hintmode = feedback.get('hintmode', None) self.hintmode = feedback.get('hintmode', None)
self.input_state = state.get('input_state', {}) self.input_state = state.get('input_state', {})
self.answervariable = state.get("answervariable", None) self.answervariable = state.get('answervariable', None)
self.response_data = state.get("response_data", None) self.response_data = state.get('response_data', None)
# put hint above msg if it should be displayed # put hint above msg if it should be displayed
if self.hintmode == 'always': if self.hintmode == 'always':
...@@ -317,9 +317,12 @@ class InputTypeBase(object): ...@@ -317,9 +317,12 @@ class InputTypeBase(object):
'value': self.value, 'value': self.value,
'status': Status(self.status, self.capa_system.i18n.ugettext), 'status': Status(self.status, self.capa_system.i18n.ugettext),
'msg': self.msg, 'msg': self.msg,
'STATIC_URL': self.capa_system.STATIC_URL, 'STATIC_URL': self.capa_system.STATIC_URL
'response_data': self.response_data
} }
if self.response_data is not None:
context['response_data'] = self.response_data
context.update( context.update(
(a, v) for (a, v) in self.loaded_attributes.iteritems() if a in self.to_render (a, v) for (a, v) in self.loaded_attributes.iteritems() if a in self.to_render
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment