@login_required
def add_group(request):
    context = {}

    if request.method == "POST":
        form = GroupForm(request.POST)
        if form.is_valid():
            group = form.save(commit=False)
            group.added_by = request.user
            group.save()
            return HttpResponseRedirect("/group/%s" % group.id)
    else:
        form = GroupForm()

    context["form"] = form
    return r2r(request, "add_group", context)
dataset/ETHPy150Open dropbox/questions/questions/views.py/add_group/original