Opened 18 years ago

Closed 18 years ago

#3005 closed defect (fixed)

[patch] Manipulators and forms documentation uses do_html2python in the wrong place (new-admin changes)

Reported by: msaelices@… Owned by: Adrian Holovaty
Component: Documentation Version:
Severity: major Keywords:
Cc: gary.wilson@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Manipulators and forms docs fails in order of doing do_html2python. If validation fails, the new_data is not converted from html to python, and for example it causes this: When you send a form and validation fails, templates doesnt show old values in selects fields.

The problem is this code:

        # Check for validation errors
        errors = manipulator.get_validation_errors(new_data)
        if errors:
            return render_to_response('places/errors.html', {'errors': errors})
        else:
            manipulator.do_html2python(new_data)
            new_place = manipulator.save(new_data)
            return HttpResponse("Place created: %s" % new_place)

the correct code is this (changes order of do_html2python):

        # Check for validation errors
        errors = manipulator.get_validation_errors(new_data)
        manipulator.do_html2python(new_data)
        if errors:
            return render_to_response('places/errors.html', {'errors': errors})
        else:
            new_place = manipulator.save(new_data)
            return HttpResponse("Place created: %s" % new_place)

Attachments (1)

forms.patch (1.8 KB ) - added by msaelices@… 18 years ago.
Patch in documentation

Download all attachments as: .zip

Change History (9)

by msaelices@…, 18 years ago

Attachment: forms.patch added

Patch in documentation

comment:1 by anonymous, 18 years ago

Summary: Manipulators and forms docs fails in order of do_html2python[patch] Manipulators and forms docs fails in order of do_html2python

comment:2 by Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: newclosed

I'm marking this as a wontfix, because the forms system is being rewritten (see django.newforms in trunk), and this wouldn't be worth fixing.

comment:3 by msaelices@…, 18 years ago

i knew newsforms package, but though old forms has deprecated, developers still can to commit errors in code :_(
i think it would be good if we correct this docs.

comment:4 by Gary Wilson <gary.wilson@…>, 18 years ago

Cc: gary.wilson@… added
Resolution: wontfix
Status: closedreopened

Not worth fixing?! Much more time is being wasted by people having problems with this (and helping people with this problem) than the 30 seconds it would take to apply the simple patch. Also, I am marking #2757 (a ticket I opened almost 2 months ago) as a dup of this ticket since the patch here is more up to date (the flatten_data() was already fixed in [3758]).

It is this sort of stuff that makes contributors not so happy inside :(

comment:5 by Gary Wilson <gary.wilson@…>, 18 years ago

Summary: [patch] Manipulators and forms docs fails in order of do_html2python[patch] Manipulators and forms documentation uses do_html2python in the wrong place (new-admin changes)

comment:6 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:7 by mir@…, 18 years ago

Triage Stage: UnreviewedReady for checkin

Adrian--though newforms is on the way, this is a simple doc-only patch, and wrong docmentation makes a bad impression.

The patch still applies (cd django/docs; patch -p0). I doublechecked it with the generic create_update view.

comment:8 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: reopenedclosed

(In [4495]) Fixed #3005 -- Applied trivial docs patch for "oldforms" use of do_html2python.

Note: See TracTickets for help on using tickets.
Back to Top