Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override machina template #146

Open
carofun opened this issue Feb 4, 2021 · 0 comments
Open

Override machina template #146

carofun opened this issue Feb 4, 2021 · 0 comments

Comments

@carofun
Copy link
Contributor

carofun commented Feb 4, 2021

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 %}
        &nbsp;<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 %}
        &nbsp;<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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant