@register.render_tag
def set_model_permissions(context, token):
    model = context[token.split_contents()[1]]
    opts = model._meta
    perm_name = opts.app_label + ".%s_" + opts.object_name.lower()
    request = context["request"]
    setattr(model, "perms", {})
    for perm_type in ("add", "change", "delete"):
        model.perms[perm_type] = request.user.has_perm(perm_name % perm_type)
    return ""
Assigns a permissions dict to the given model, much like Django
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/templatetags/pages_tags.py/set_model_permissions