Code

Opened 5 years ago

Closed 5 years ago

#11252 closed (fixed)

Invalid XHTML when filtering a paginated list

Reported by: daemondazz Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The admin sites generates invalid XHTML when viewing a filtered list of objects and that list needs to be paginated. The invalid tags are the links for jumping to different pages in the result set which have query string like "?p=2&domain__exact=1" instead of "?p=2&domain__exact=1".

This manifests if the site has

DEFAULT_CONTENT_TYPE = 'application/xhtml+xml'

set in the settings file: Firefox displays an error message about the invalid XHTML code and is not able to show the page.

The culprit in this case is passing the results of urllib.urlencode directly back to the HTML without fixing the amperstands.

Patch to be attached in a moment.

Attachments (2)

django_admin_pagination_fixamperstands.patch (1.2 KB) - added by daemondazz 5 years ago.
Patch to wrap the return of urllib.urlencode in fix_amperstands
django_admin_pagination_escape.patch (788 bytes) - added by daemondazz 5 years ago.
Updated patch using escape()

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by daemondazz

Patch to wrap the return of urllib.urlencode in fix_amperstands

comment:1 Changed 5 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.0 to SVN

Should just use escape

Changed 5 years ago by daemondazz

Updated patch using escape()

comment:2 Changed 5 years ago by daemondazz

Update to use escape() as suggested.

comment:3 Changed 5 years ago by SmileyChris

  • Patch needs improvement unset
  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 5 years ago by daemondazz

Any movement on this ticket? I still need to apply the patch against 1.1

comment:5 Changed 5 years ago by SmileyChris

Bring up requests like this in the django developers google group.

If you wanted to make this patch better, you could write a test too.

comment:6 Changed 5 years ago by lukeplant

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

(In [11486]) Fixed #11252: Invalid XHTML when filtering a paginated list.

Thanks daemondazz

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.