[Answer]-Django – AttributeError – 'unicode' object has no attribute 'META'

1👍

The error is in the Activity.get_rendered_html() method.

django.shortcuts.render expects request object as it’s first parameter. You should use render_to_string instead of render:

from django.template.loader import render_to_string

def get_rendered_html(self):
    template_name = '%s_activity.html' %(self.content_type.name)
    return render_to_string(template_name, {
        'object':self.content_object,
        'actor':self.actor,
        'action':self.action,
    })

Leave a comment