Opened 10 years ago

Closed 10 years ago

#5286 closed (fixed)

Non-HTML output in python adminindex <appname>

Reported by: dan.fairs@… Owned by: Alexander Solovyov
Component: contrib.admin Version: master
Severity: Keywords: admin adminindex repr str proxy
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This is on Django trunk rev 6023, running on python 2.4.3 compiled from source on Mac OS X 10.4.10, running with PostgreSQL (again from source) 8.1.4.

I created a simple project 'qwacks' with a single app 'diary'. I created a very simple model (attached). Settings and configuration also attached. I then added a custom directory to TEMPLATE_DIRS, preparing to customise teh Django index page as described in

Upon running python adminindex diary, I get the following output:

{% if perms.diary %}
<div class="module"><h2>Diary</h2><table>
    {% if perms.diary.add_event or perms.diary.change_event %}
        <th>{% if perms.diary.change_event %}<a href="diary/event/">{% endif %}<django.utils.functional.__proxy__ object at 0x1381550>{% if perms.diary.change_event %}</a>{% endif %}</th>
        <td class="x50">{% if perms.diary.add_event %}<a href="diary/event/add/" class="addlink">{% endif %}Add{% if perms.diary.add_event %}</a>{% endif %}</td>
        <td class="x75">{% if perms.diary.change_event %}<a href="diary/event/" class="changelink">{% endif %}Change{% if perms.diary.change_event %}</a>{% endif %}</td>
    {% endif %}
{% endif %}

Note what appears to be a python object repr in the th tag.

Please let me know if you need any more information.

Attachments (3) (666 bytes) - added by dan.fairs@… 10 years ago.
5286.diff (1.2 KB) - added by Alexander Solovyov 10 years ago.
force_unicode applied
5286.2.diff (1.1 KB) - added by Alexander Solovyov 10 years ago.
debug output removed

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by dan.fairs@…

Attachment: added

comment:1 Changed 10 years ago by Adrian Holovaty

Triage Stage: UnreviewedAccepted

Good catch!

comment:2 Changed 10 years ago by Arthur Koziel

I've experienced the same by doing the Poll tutorial (Part 2, at the end of the page).

python adminindex polls

Output is:

{% if perms.polls %}
<div class="module"><h2>Polls</h2><table>
    {% if perms.polls.add_poll or perms.polls.change_poll %}
        <th>{% if perms.polls.change_poll %}<a href="polls/poll/">{% endif %}<django.utils.functional.__proxy__ object at 0x10716b0>{% if perms.polls.change_poll %}</a>{% endif %}</th>
        <td class="x50">{% if perms.polls.add_poll %}<a href="polls/poll/add/" class="addlink">{% endif %}Add{% if perms.polls.add_poll %}</a>{% endif %}</td>
        <td class="x75">{% if perms.polls.change_poll %}<a href="polls/poll/" class="changelink">{% endif %}Change{% if perms.polls.change_poll %}</a>{% endif %}</td>
    {% endif %}
    {% if perms.polls.add_choice or perms.polls.change_choice %}
        <th>{% if perms.polls.change_choice %}<a href="polls/choice/">{% endif %}<django.utils.functional.__proxy__ object at 0x1425d90>{% if perms.polls.change_choice %}</a>{% endif %}</th>
        <td class="x50">{% if perms.polls.add_choice %}<a href="polls/choice/add/" class="addlink">{% endif %}Add{% if perms.polls.add_choice %}</a>{% endif %}</td>
        <td class="x75">{% if perms.polls.change_choice %}<a href="polls/choice/" class="changelink">{% endif %}Change{% if perms.polls.change_choice %}</a>{% endif %}</td>
    {% endif %}
{% endif %}

Changed 10 years ago by Alexander Solovyov

Attachment: 5286.diff added

force_unicode applied

Changed 10 years ago by Alexander Solovyov

Attachment: 5286.2.diff added

debug output removed

comment:3 Changed 10 years ago by Alexander Solovyov

Has patch: set
Owner: changed from nobody to Alexander Solovyov
Status: newassigned

Force_unicode applied to lazy element.

comment:4 Changed 10 years ago by Adrian Holovaty

Resolution: fixed
Status: assignedclosed

(In [6199]) Fixed #5286 -- Fixed non-HTML output bug in adminindex command. Thanks, dan.fairs@… and piranha

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