Certificate displays None type

Hi, I am using tutor 17.0.0

Upon completing and requesting a certificate, when I try to view it at: http://local.edly.io/certificates/9c4951a61201481b8c30162c637918a6

everything looks fine, except one part, the so-called certificate_type part that is actually just the user_certificate.mode, is None. So I get this:

testuser successfully completed, received a passing grade, and was awarded this My Open edX None Certificate of Completion in…

I’ve dug up the code a little bit, and I found out this part is rendered in tutor/edx-platform/lms/static/templates/certificates/_accomplishment-rendering.html

at this line of code:
<span class="accomplishment-summary copy copy-lead">${accomplishment_copy_description_full}</span>

And this accomplishment_copy_description_full variable is being passed by backend from tutor/edx-platform/lms/djangoapps/certificates/views/webview.py

this is set inside of _update_certificate_context function, it’s contents being:

    context['accomplishment_copy_description_full'] = _("successfully completed, received a passing grade, and was "
                                                        "awarded this {platform_name} {certificate_type} "
                                                        "Certificate of Completion in ").format(

this function is called by a function returning a response, called render_html_view, inside of it:
_update_certificate_context(context, course, course_overview, user_certificate, platform_name)

passes a context object that is later used by update_certificate_context to get the certificate_type from as:
certificate_type = context.get('certificate_type')

but I do not see where this certificate_type field is ever populated to this context object. Also, why not just use user_certificate.mode instead of certificate_type? When I change the source code to do that, it works.

Anyone has any idea if this is a bug in OpenEdx or I am missing something?

Hi Muhamed,
We experience exactly the same. Using version 16.1.8. It worked fine, then suddenly “None” appear in the certificate. The server is an EC2-instance on AWS. After a freeze of the server and a subsequent restart, the “None” apperared. If the freeze is the reason or not, we don’t know.
Do you have any progress with this?

Hi @RoarB, haven’t been on here for a while. I solved this issue back then but forgot to add an answer. What I’ve done is inside render_html_view function (that is inside webview.py), I changed
context = {'user_language': user_language}
context = {'user_language': user_language, 'certificate_type': user_certificate.mode}
This is the line 606 for me. After this, certificate_type should be displayed without a problem.

Hi Muhamed, thank’s for reply. We resolved this by edit the certificate template for the course(based on an example layout we found). That worked for us.

1 Like