post_list template
In post_list.html we use an empty tag to present a "Sorry, no posts" message if the for loop determines that there are no posts.
This message is a list item, but from a semantic HTML point of view I suppose we'd instead want no <ul> at all.
Is there a sensible way to do this?
Thanks for any thoughts
Sorry You must be a logged in, registered user to answer a question.
Answers
{% if object_list %}
<ul>
{% for object in object_list %}
<li>{{ object.title }}</li>
{% endfor %}
</ul>
{% else %}
<p>Sorry, no posts</p>
{% endif %}
It's way more verbose and I don't think these semantics are that important. But, still, it's definitely doable and up to you how you'd like to approach it.
thanks