-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Feature Request
Be able to override a block template rather than the whole template in Django Machina
Django Machina is used in Ashley as a forum base. We want to add extra information on a repeated html block that presents the owner of a post or a topic. Our specific use is to add an icon depending on user's role in different views. The way templates are build in Machina forces us to override the entire template. It would be more convenient if we could juste override this specific bloc rather tant the whole file.
This is the list of template files concerned by this request in Django Machina :
- forum/forum_list.html
- forum_conversation/post_create.html
- forum_conversation/topic_detail.html
- forum_conversation/topic_list.html
- forum_member/user_posts_list.html
- forum_moderation/moderation_queue/detail.html
- forum_moderation/moderation_queue/list.html
- forum_search/search.html
This is the look of the html block
{% if node.last_post.poster %}
{% url 'forum_member:profile' node.last_post.poster_id as poster_url %}
{% blocktrans trimmed with poster_url=poster_url username=node.last_post.poster|forum_member_display_name %}
By: <a href="{{ poster_url }}">{{ username }}</a>
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with poster_username=node.last_post.username %}
By: {{ poster_username }}
{% endblocktrans %}
{% endif %}
<a href="{% url 'forum_conversation:topic' node.obj.slug node.obj.pk node.last_post.topic.slug node.last_post.topic.pk %}?post={{ node.last_post.pk }}#{{ node.last_post.pk }}"><i class="fas fa-arrow-circle-right "></i></a>
<br />
<small>{{ node.last_post.created }}</small>
{% else %}
{% trans "No posts" %}
{% endif %}{% if node.last_post %}
{% if node.last_post.poster %}
{% url 'forum_member:profile' node.last_post.poster_id as poster_url %}
{% blocktrans trimmed with poster_url=poster_url username=node.last_post.poster|forum_member_display_name %}
By: <a href="{{ poster_url }}">{{ username }}</a>
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with poster_username=node.last_post.username %}
By: {{ poster_username }}
{% endblocktrans %}
{% endif %}
<a href="{% url 'forum_conversation:topic' node.obj.slug node.obj.pk node.last_post.topic.slug node.last_post.topic.pk %}?post={{ node.last_post.pk }}#{{ node.last_post.pk }}"><i class="fas fa-arrow-circle-right "></i></a>
<br />
<small>{{ node.last_post.created }}</small>
{% else %}
{% trans "No posts" %}
{% endif %}
Describe the solution you'd like
We would like to write a PR in Django Machina to export this block of code in a block that could be overrided.