Ejemplo n.º 1
0
Archivo: views.py Proyecto: 5n1p/treeio
def group_add(request, response_format='html'):
    "Group add"

    if request.POST:
        if not 'cancel' in request.POST:
            form = GroupForm(request.POST)
            if form.is_valid():
                group = form.save()
                return HttpResponseRedirect(reverse('core_admin_group_view', args=[group.id]))
        else:
            return HttpResponseRedirect(reverse('core_admin_index_groups'))

    else:
        form = GroupForm()

    return render_to_response('core/administration/group_add',
                              {'form': form},
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 2
0
Archivo: views.py Proyecto: 5n1p/treeio
def group_edit(request, group_id, response_format='html'):
    "Group edit"

    group = get_object_or_404(Group, pk=group_id)

    if request.POST:
        if not 'cancel' in request.POST:
            form = GroupForm(request.POST, instance=group)
            if form.is_valid():
                group = form.save()
                return HttpResponseRedirect(reverse('core_admin_group_view', args=[group.id]))
        else:
            return HttpResponseRedirect(reverse('core_admin_group_view', args=[group.id]))
    else:
        form = GroupForm(instance=group)

    return render_to_response('core/administration/group_edit',
                              {'group': group,
                               'form': form},
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 3
0
def group_add(request, response_format='html'):
    "Group add"

    if request.POST:
        if not 'cancel' in request.POST:
            form = GroupForm(request.POST)
            if form.is_valid():
                group = form.save()
                return HttpResponseRedirect(
                    reverse('core_admin_group_view', args=[group.id]))
        else:
            return HttpResponseRedirect(reverse('core_admin_index_groups'))

    else:
        form = GroupForm()

    return render_to_response('core/administration/group_add', {'form': form},
                              context_instance=RequestContext(request),
                              response_format=response_format)
Ejemplo n.º 4
0
def group_edit(request, group_id, response_format='html'):
    "Group edit"

    group = get_object_or_404(Group, pk=group_id)

    if request.POST:
        if not 'cancel' in request.POST:
            form = GroupForm(request.POST, instance=group)
            if form.is_valid():
                group = form.save()
                return HttpResponseRedirect(
                    reverse('core_admin_group_view', args=[group.id]))
        else:
            return HttpResponseRedirect(
                reverse('core_admin_group_view', args=[group.id]))
    else:
        form = GroupForm(instance=group)

    return render_to_response('core/administration/group_edit', {
        'group': group,
        'form': form
    },
                              context_instance=RequestContext(request),
                              response_format=response_format)