Skip to content

Commit

Permalink
Fixes #15025: can_add() template filter should accept a model (not an…
Browse files Browse the repository at this point in the history
… instance)
  • Loading branch information
jeremystretch committed Feb 2, 2024
1 parent 59510b4 commit 25ff931
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions netbox/utilities/templatetags/perms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def can_view(user, instance):


@register.filter()
def can_add(user, instance):
return _check_permission(user, instance, 'add')
def can_add(user, model):
permission = get_permission_for_model(model, 'add')
return user.has_perm(perm=permission)


@register.filter()
Expand Down

0 comments on commit 25ff931

Please sign in to comment.