add edit link to authors

This commit is contained in:
DELL 2022-10-17 12:12:20 +07:00
parent 36e0cd797c
commit 4345e289e8

View file

@ -27,8 +27,21 @@
{% trans time=post.publish_on|date(_("N j, Y, g:i a")) %} posted on {{ time }}{% endtrans %} {% trans time=post.publish_on|date(_("N j, Y, g:i a")) %} posted on {{ time }}{% endtrans %}
</span> </span>
{% if post.is_editable_by(request.user) %} {% if post.is_editable_by(request.user) %}
<span> [<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]</span> <span> [<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]</span>
{% else %}
{% for author in post.authors.all() %}
{% if author.user == request.user %}
{% for post_org in post.organizations.all() %}
{% for org in author.organizations.all() %}
{% if org == post_org %}
<span> [<a href="{{ url('edit_organization_blog', org.id , org.slug , post.id) }}">{{ _('Edit') }}</a>]</span>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %} {% endif %}
</div> </div>
<div class="body content-description"> <div class="body content-description">
{% cache 86400 'post_content' post.id MATH_ENGINE %} {% cache 86400 'post_content' post.id MATH_ENGINE %}