mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added fitlers to return the verbose model name of an object
This commit is contained in:
@@ -46,6 +46,22 @@ def gfm(value):
|
|||||||
return mark_safe(html)
|
return mark_safe(html)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def model_name(obj):
|
||||||
|
"""
|
||||||
|
Return the name of the model of the given object
|
||||||
|
"""
|
||||||
|
return obj._meta.verbose_name
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def model_name_plural(obj):
|
||||||
|
"""
|
||||||
|
Return the plural name of the model of the given object
|
||||||
|
"""
|
||||||
|
return obj._meta.verbose_name_plural
|
||||||
|
|
||||||
|
|
||||||
@register.filter()
|
@register.filter()
|
||||||
def contains(value, arg):
|
def contains(value, arg):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user