Problem update:
I tried adding the following to webviews.py
from courseware.models import StudentModule
Then I added below: " # Translators: The format of the date includes the full name of the month"
all_fields = StudentModule._meta.get_field('grade')
print(all_fields)
context['allfields'] = all_fields
HTML ammendments to lms/templates/certificates/_accomplishment-rendering.html
I pasted this under (line 8(
<p>${allfields}</p>
The following error keeps occuring when I try to preview the certificate:
Nov 20 10:14:05 ip-172-31-21-194 [service_variant=lms][util.views][env:sandbox] ERROR [ip-172-31-21-194 2670] [views.py:154] - Error in django view.
Traceback (most recent call last):
File “/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py”, line 145, in inner
return func(request, *args, **kwargs)
File “/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py”, line 614, in render_html_view
File "/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py", line 680, in _render_valid_certificate
def _render_valid_certificate(request, context, custom_template=None):
File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 169, in render_to_response
return HttpResponse(render_to_string(template_name, dictionary, namespace, request), **kwargs)
File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/shortcuts.py", line 159, in render_to_string
return template.render(dictionary, request)
File "/edx/app/edxapp/edx-platform/common/djangoapps/edxmako/template.py", line 59, in render
return self.mako_template.render_unicode(**context_dictionary)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/template.py", line 454, in render_unicode
as_unicode=True)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 829, in _render
**_kwargs_for_callable(callable_, data))
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 864, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 890, in _exec_template
callable_(context, *args, **kwargs)
File "/tmp/mako_lms/e925696d8b14fbe9ce4148f457a131c3/custom-theme/lms/templates/certificates/accomplishment-base.html.py", line 77, in render_body
__M_writer(filters.html_escape(filters.decode.utf8(self.body())))
File "/tmp/mako_lms/e925696d8b14fbe9ce4148f457a131c3/custom-theme/lms/templates/certificates/valid.html.py", line 45, in render_body
runtime._include_file(context, u'_accomplishment-rendering.html', _template_uri)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 752, in _include_file
callable_(ctx, **_kwargs_for_include(callable_, context._data, **kwargs))
File "/tmp/mako_lms/e925696d8b14fbe9ce4148f457a131c3/custom-theme/lms/templates/certificates/_accomplishment-rendering.html.py", line 63, in render_body
__M_writer(filters.html_escape(filters.decode.utf8(allfields)))
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/filters.py", line 78, in decode
return decode(str(x))
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/mako/runtime.py", line 226, in __str__
raise NameError("Undefined")
NameError: Undefined
Any idea on how i can solve this?