Commit a9b7a981 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Do now allow owner to leave group: remove link from group search

parent fa4e420c
......@@ -91,9 +91,11 @@
{% if o.membership_approval_date %}
Registered
<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
<input type="submit" value="LEAVE GROUP" />
</form>
{% if not o.is_owner %}
<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
<input type="submit" value="LEAVE GROUP" />
</form>
{% endif %}
......
......@@ -885,6 +885,12 @@ def group_search(request, extra_context=None, **kwargs):
SELECT date_joined FROM im_membership
WHERE group_id = im_astakosgroup.group_ptr_id
AND person_id = %s)
THEN 1 ELSE 0 END""" % request.user.id,
'is_owner': """
SELECT CASE WHEN EXISTS(
SELECT id FROM im_astakosuser_owner
WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
AND astakosuser_id = %s)
THEN 1 ELSE 0 END""" % request.user.id})
if sorting:
# TODO check sorting value
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment