templatetags: return on none type object
This commit is contained in:
parent
89f80ad103
commit
be224d0efb
|
@ -59,6 +59,8 @@ def do_get_tracks(obj):
|
|||
@register.simple_tag(name="has_perm", takes_context=True)
|
||||
def do_has_perm(context, obj, perm, user=None, simple=False):
|
||||
"""Return True if ``user.has_perm('[APP].[perm]_[MODEL]')``"""
|
||||
if not obj:
|
||||
return
|
||||
if user is None:
|
||||
user = context["request"].user
|
||||
if simple:
|
||||
|
|
Loading…
Reference in New Issue
Block a user