def allocation_new(request):
    from forms import AllocationForm
    initial = {}
    if request.method == 'POST':
        form = AllocationForm(request.POST, initial=initial)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/systems/allocations/')
    else:
        form = AllocationForm(initial=initial)

    return render_to_response('generic_form.html', {
        'form': form,
    }, RequestContext(request))
def allocation_edit(request, object_id):
    allocation = get_object_or_404(models.Allocation, pk=object_id)
    from forms import AllocationForm
    initial = {}
    if request.method == 'POST':
        form = AllocationForm(request.POST, instance=allocation)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/systems/allocations/')
    else:
        form = AllocationForm(instance=allocation)

    return render_to_response('generic_form.html', {
        'form': form,
    }, RequestContext(request))