Ejemplo n.º 1
0
def create_notepad(request):
    form = None
    if request.method == 'POST':
        form = NotepadForm(request.POST)
        if form.is_valid():
            notepad = Notepad()
            notepad.assignID()
            notepad.owner = request.user
            notepad.title = form.cleaned_data['title']
            notepad.description = form.cleaned_data['description']
            notepad.save()
            return HttpResponseRedirect('/notepad')
    return render_to_response('notepad/create_notepad.html', {'form':form}, 
                              context_instance=RequestContext(request))
Ejemplo n.º 2
0
def settings(request, notepad_id):
    notepad = get_object_or_404(Notepad, pk=notepad_id)
    form = None
    if request.method == 'POST':
        form = NotepadForm(request.POST)
        if form.is_valid():
            notepad.title = form.cleaned_data['title']
            notepad.description = form.cleaned_data['description']
            notepad.report_model = form.cleaned_data['report_model']
            notepad.save()
    return render_to_response('notepad/settings.html', 
                              {'notepad': notepad,
                               'form': form,
                               'active_tab': 'settings'},
                              context_instance=RequestContext(request))