Exemple #1
0
def create_extra_db(request):
    form = ExternalDatabasesForm()
    form_url = "/webconf/externaldbs/post_extra_db/"
    context = {
        'form': form,
        'form_url': form_url,
    }
    return render_to_response('webconf/externaldbs/form_extra_dbs.html',
                              context,
                              context_instance=RequestContext(request))
Exemple #2
0
def edit_extra_db(request, db_id):
    database = ExternalDatabases.objects.get(id=db_id)
    form = ExternalDatabasesForm(instance=database)
    form_url = "/webconf/externaldbs/post_extra_db/%s/" % db_id
    context = {
        'form': form,
        'form_url': form_url,
        'database': database,
    }
    return render_to_response('webconf/externaldbs/form_extra_dbs.html',
                              context,
                              context_instance=RequestContext(request))
Exemple #3
0
def new_extra_db(request):
    if request.method == 'POST':
        form = ExternalDatabasesForm(request.POST)
        if form.is_valid():
            database = ExternalDatabases()
            database.name = form.cleaned_data['name']
            database.engine = form.cleaned_data['engine']
            database.database_name = form.cleaned_data['database_name']
            database.host = form.cleaned_data['host']
            database.port = form.cleaned_data['port']
            database.username = form.cleaned_data['username']
            database.password = form.cleaned_data['password']
            database.save()
            return HttpResponseRedirect('/webconf/externaldbs/')
        context = {
            'form': form,
        }
        return render_to_response('webconf/externaldbs/form_extra_dbs.html',
                                  context,
                                  context_instance=RequestContext(request))

    return HttpResponseRedirect('/webconf/externaldbs/')
Exemple #4
0
def new_extra_db(request):
    if request.method == 'POST':
        form = ExternalDatabasesForm(request.POST)
        if form.is_valid():
            database = ExternalDatabases()
            database.name = form.cleaned_data['name']
            database.engine = form.cleaned_data['engine']
            database.database_name = form.cleaned_data['database_name']
            database.host = form.cleaned_data['host']
            database.port = form.cleaned_data['port']
            database.username = form.cleaned_data['username']
            database.password = form.cleaned_data['password']
            database.save()
            return HttpResponseRedirect('/webconf/externaldbs/')
        context = { 'form' : form,
                    }
        return render_to_response('webconf/externaldbs/form_extra_dbs.html',
                                  context,              
                                  context_instance=RequestContext(request)
                                  )

    return HttpResponseRedirect('/webconf/externaldbs/')