示例#1
0
def group_detail(request, groupname):
    radgroup = get_group(groupname)
    if radgroup is None:
        return HttpResponseNotFound('not found')

    if request.method == 'POST':
        form = RadGroupForm(request.POST)
        if form.is_valid():
            assert groupname == form.cleaned_data['groupname']
            simultaneous_use = form.cleaned_data['simultaneous_use']
            gd = RadGroup(groupname=groupname)
            gd.set_simultaneous_use(simultaneous_use)

            messages.success(request, 'Group %s updated.' % groupname)
            return HttpResponseRedirect(
                reverse('djra.radmin.views.group_detail',
                        kwargs={'groupname': groupname}))
    else:
        form = RadGroupForm({
            'groupname':
            groupname,
            'simultaneous_use':
            RadGroup(groupname).simultaneous_use
        })

    return render_to_response('radmin/group_detail.html', {
        'group': radgroup,
        'form': form,
        'request': request
    },
                              context_instance=RequestContext(request))
示例#2
0
def group_detail(request, groupname):
    radgroup = get_group(groupname)
    if radgroup is None:
        return HttpResponseNotFound('not found')

    if request.method == 'POST':
        form = RadGroupForm(request.POST)
        if form.is_valid():
            assert groupname == form.cleaned_data['groupname']
            simultaneous_use=form.cleaned_data['simultaneous_use']
            gd = RadGroup(groupname=groupname)
            gd.set_simultaneous_use(simultaneous_use)

            messages.success(request, 'Group %s updated.' %groupname)
            return HttpResponseRedirect(reverse('djra.radmin.views.group_detail', kwargs={'groupname' : groupname}))
    else:
        form = RadGroupForm({
            'groupname' : groupname,
            'simultaneous_use' : RadGroup(groupname).simultaneous_use
        })
 
    return render_to_response(
        'radmin/group_detail.html',
        {'group' : radgroup, 'form' : form, 'request' : request},
        context_instance = RequestContext(request)
    )
示例#3
0
def create_group(request):
    if request.method == 'POST':
        form = NewRadGroupForm(request.POST)
        if form.is_valid():
            groupname=form.cleaned_data['groupname']
            simultaneous_use=form.cleaned_data['simultaneous_use']
            gd = RadGroup(groupname=groupname)
            gd.set_simultaneous_use(simultaneous_use)

            messages.success(request, 'Group %s created.' %groupname)
            return HttpResponseRedirect(reverse('djra.radmin.views.group_detail', kwargs={'groupname' : groupname}))
    else:
        form = NewRadGroupForm()
        
    return render_to_response(
        'radmin/create_group.html',
        {'form' : form, 'request' : request},
        context_instance = RequestContext(request)
    )
示例#4
0
def create_group(request):
    if request.method == 'POST':
        form = NewRadGroupForm(request.POST)
        if form.is_valid():
            groupname = form.cleaned_data['groupname']
            simultaneous_use = form.cleaned_data['simultaneous_use']
            gd = RadGroup(groupname=groupname)
            gd.set_simultaneous_use(simultaneous_use)

            messages.success(request, 'Group %s created.' % groupname)
            return HttpResponseRedirect(
                reverse('djra.radmin.views.group_detail',
                        kwargs={'groupname': groupname}))
    else:
        form = NewRadGroupForm()

    return render_to_response('radmin/create_group.html', {
        'form': form,
        'request': request
    },
                              context_instance=RequestContext(request))