Opened 9 years ago

Closed 8 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
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: UI/UX:

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@… 9 years ago.
Patch in documentation

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by msaelices@…

Patch in documentation

comment:1 Changed 9 years ago by anonymous

  • Summary changed from Manipulators and forms docs fails in order of do_html2python to [patch] Manipulators and forms docs fails in order of do_html2python

comment:2 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

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 Changed 9 years ago by msaelices@…

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 Changed 9 years ago by Gary Wilson <gary.wilson@…>

  • Cc gary.wilson@… added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

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 Changed 9 years ago by Gary Wilson <gary.wilson@…>

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

comment:6 Changed 9 years ago by anonymous

  • milestone Version 1.0 deleted

Milestone Version 1.0 deleted

comment:7 Changed 9 years ago by mir@…

  • Triage Stage changed from Unreviewed to Ready 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 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

(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