Can delete Godfathers

This commit is contained in:
2016-09-29 15:04:43 +02:00
parent a008f34288
commit 2c6f17063a
4 changed files with 48 additions and 17 deletions

View File

@ -55,3 +55,9 @@
</ul>
{% endif %}
{% endmacro %}
{% macro delete_godfather(user, profile, godfather, is_father) %}
{% if user == profile or user.is_root or user.is_board_member %}
<a href="{{ url("core:user_godfathers_delete", user_id=profile.id, godfather_id=godfather.id, is_father=is_father) }}">{% trans %}Delete{% endtrans %}</a>
{% endif %}
{% endmacro %}

View File

@ -1,26 +1,34 @@
{% extends "core/base.jinja" %}
{% from "core/macros.jinja" import user_link_with_pict %}
{% from "core/macros.jinja" import user_link_with_pict, delete_godfather %}
{% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s godfathers{% endtrans %}
{% endblock %}
{% block content %}
<h4>{% trans %}Godfathers{% endtrans %}</h4>
<ul>
{% for u in profile.godfathers.all() %}
<li> <a href="{{ url("core:user_godfathers", user_id=u.id) }}" class="mini_profile_link" >
{{ u.get_mini_item()|safe }} </a> </li>
{% endfor %}
</ul>
<h4>{% trans %}Godchildren{% endtrans %}</h4>
<ul>
{% for u in profile.godchildren.all() %}
<li> <a href="{{ url("core:user_godfathers", user_id=u.id) }}" class="mini_profile_link" >
{{ u.get_mini_item()|safe }} </a> </li>
{% endfor %}
</ul>
{% if profile == user %}
{% if profile.godfathers.exists() %}
<h4>{% trans %}Godfathers{% endtrans %}</h4>
<ul>
{% for u in profile.godfathers.all() %}
<li> <a href="{{ url("core:user_godfathers", user_id=u.id) }}" class="mini_profile_link" >
{{ u.get_mini_item()|safe }} </a>{{ delete_godfather(user, profile, u, True) }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans %}No godfathers{% endtrans %}
{% endif %}
{% if profile.godchildren.exists() %}
<h4>{% trans %}Godchildren{% endtrans %}</h4>
<ul>
{% for u in profile.godchildren.all() %}
<li> <a href="{{ url("core:user_godfathers", user_id=u.id) }}" class="mini_profile_link" >
{{ u.get_mini_item()|safe }} </a>{{ delete_godfather(user, profile, u, False) }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans %}No godchildren{% endtrans %}
{% endif %}
{% if profile == user or user.is_root %}
<form action="" method="post">
{% csrf_token %}
{{ form.as_p() }}