'Returns context dictionary with common admin and object permissions
related content. It uses AdminSite.each_context (available in Django >= 1.8,
making sure all required template vars are in the context.'

def get_obj_perms_base_context(self, request, obj):

    if (django.VERSION >= (1, 8)):
        context = self.admin_site.each_context(request)
    else:
        context = {}
    context.update({u'adminform': {u'model_admin': self}, u'media': self.media, u'object': obj, u'app_label': self.model._meta.app_label, u'opts': self.model._meta, u'original': ((hasattr(obj, u'__unicode__') and obj.__unicode__()) or str(obj)), u'has_change_permission': self.has_change_permission(request, obj), u'model_perms': get_perms_for_model(obj), u'title': _(u'Object    permissions')})
    return context
