Exemplo n.º 1
0
def relation_end(request, _id):
    rel = Es.relation_by_id(_id)
    if rel is None:
        raise Http404
    if not Es.user_may_end_relation(request.user, rel):
        raise PermissionDenied
    Es.end_relation(_id)
    giedo.sync()
    return redirect_to_referer(request)
Exemplo n.º 2
0
def relation_end(request, _id):
    rel = Es.relation_by_id(_id)
    if rel is None:
        raise Http404
    if not Es.user_may_end_relation(request.user, rel):
        raise PermissionDenied
    Es.end_relation(_id)

    # Notify informacie
    # TODO (rik) leave out 'als lid'
    Es.notify_informacie('relation_end', request.user, relation=_id)

    giedo.sync_async(request)
    return redirect_to_referer(request)
Exemplo n.º 3
0
def relation_end(request, _id):
    rel = Es.relation_by_id(_id)
    if rel is None:
        raise Http404
    if not Es.relation_is_active(rel):
        messages.info(request, _("Relatie was al beëindigd."))
        return redirect_to_referer(request)
    if not Es.user_may_end_relation(request.user, rel):
        raise PermissionDenied
    Es.end_relation(_id)

    # Notify informacie
    # TODO (rik) leave out 'als lid'
    Es.notify_informacie('relation_end', request.user, relation=_id)

    giedo.sync_async(request)
    return redirect_to_referer(request)
Exemplo n.º 4
0
def relation_end(request, _id):
    rel = Es.relation_by_id(_id)
    if rel is None:
        raise Http404
    if not Es.user_may_end_relation(request.user, rel):
        raise PermissionDenied
    Es.end_relation(_id)

    # Notify informacie
    if request.user == rel['who']:
        Es.notify_informacie('relation_ended', relation=_id)
    else:
        # TODO (rik) leave out 'als lid'
        Es.notify_informacie('relation_end', relation=_id)

    giedo.sync_async(request)
    return redirect_to_referer(request)
Exemplo n.º 5
0
def relation_end(request, _id):
    rel = Es.relation_by_id(_id)
    if rel is None:
        raise Http404
    if not Es.user_may_end_relation(request.user, rel):
        raise PermissionDenied
    Es.end_relation(_id)
    # Notify informacie
    if request.user == rel['who']:
        Es.notify_informacie("%s heeft zich uitgeschreven als %s %s" % (
                        request.user.full_name,
                        rel['how'].humanName if rel['how'] else 'lid',
                        rel['with'].humanName.genitive))
    else:
        # TODO (rik) leave out 'als lid'
        Es.notify_informacie("%s is geen %s meer %s" % (
                        rel['who'].humanName,
                        rel['how'].humanName if rel['how'] else 'lid',
                        rel['with'].humanName.genitive))
    giedo.sync_async(request)
    return redirect_to_referer(request)