コード例 #1
0
ファイル: views.py プロジェクト: hjf288/avrse-auth
def groups_leave(request, group_id):
    group = Group.objects.get(id=group_id)
    request.user.groups.remove(group)
    messages.success(request, "Left group %s" % group.name)

    update_discord.delay(request.user.id)

    return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
コード例 #2
0
def groupadmin_app_complete(request, app_id, yesno):
    app = GroupApp.objects.get(id=app_id)
    if yesno == "accept":
        app.complete(True, request.user)
        update_discord.delay(app.user.id)
    else:
        app.complete(False, request.user)

    return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
コード例 #3
0
ファイル: views.py プロジェクト: hjf288/avrse-auth
def groups_join(request, group_id):
    group = Group.objects.get(id=group_id)
    if group.details.is_open == True:
        request.user.groups.add(group)
        messages.success(request, "Joined group %s" % group.name)

        update_discord.delay(request.user.id)

    return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
コード例 #4
0
def groupadmin_kick(request, group_id, user_id):
    user = User.objects.get(id=user_id)
    group = Group.objects.get(id=group_id)
    group.user_set.remove(user)

    update_discord.delay(user.id)

    messages.success(request, 'Kicked %s from %s' % (user.profile.character.name, group.name))
    return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))