I have custome filter in to_and.py file for getting verbose name
from django import template
register = template.Library()
@register.filter
def verbose_name(objects):
return objects._meta.verbose_name
but when I get the value in view it only give me the first model name in iteration my code queryset has two indivial model
{% load to_and %}
{{links}}
{% for link in links %}
{% if link|verbose_name == "Unit" %}
{{link|verbose_name}}
{{link.id}}
{% endif %}
{% endfor %}
in models I forget to change the verbose name of SubUnits
just Change the verbose_name in models
class Meta:
"""Meta definition for Unit."""
verbose_name = 'SubUnit'
verbose_name_plural = 'SubUnits'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.