fix handling of empty publisher names

main
eric 2023-04-27 17:04:45 -04:00
parent 044f5a030d
commit 62e00928f4
2 changed files with 6 additions and 1 deletions

View File

@ -8,7 +8,7 @@ DOAB Linkchecking by Publisher
</h2>
<ul>
{% for publisher in publisher_list %}
<li><a href="{% url 'publisher' publisher.publisher_name %}">
<li><a href="{% url 'publisher' publisher.publisher_name|default:'*** no publisher name ***' %}">
{% if publisher.publisher_name %}{{publisher.publisher_name}}
{% else %}*** no publisher name ***
{% endif %}

View File

@ -48,5 +48,10 @@ class PublisherView(generic.TemplateView):
publisher = {'publisher': pub}
publisher_items = Item.objects.filter(publisher_name=pub, status=1)
publisher['link_count'] = publisher_items.count()
if pub == '*** no publisher name ***':
pub = ''
publisher_items = Item.objects.filter(
publisher_name=pub, status=1,
)
return {'publisher': publisher, 'items': publisher_items}