Change: Editing Form Data

created on Sept. 25, 2012, 7:26 p.m. by Hevok & updated on Oct. 14, 2012, 11:39 p.m. by Hevok

In order to update and entry rather than to create a new one instance of this data entry needs to be retrieved from the database as first and passed to the form: ::

form django.http import HttpResponseRedirect

from forms import EntryForm
form data.models import Entry

def view(request, id):
    if request.method == 'POST':
        entry = Entry.objects.get(id__exact=id)
        form = EntryForm(request.POST, instance=Entry)

        if form.is_valid():
            entry =

            return HttpResonseRedirect('/details/%s/' % (

Parent: Web Framework

Comment: Updated Entry

See entry | Admin

Comment on This Data Unit