Opened 17 years ago

Closed 17 years ago

#5286 closed (fixed)

Non-HTML output in python manage.py adminindex <appname>

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

Description

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 http://www.djangoproject.com/documentation/tutorial02/.

Upon running python manage.py 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 %}
    <tr>
        <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>
    </tr>
    {% endif %}
</table></div>
{% 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)

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

Download all attachments as: .zip

Change History (7)

by dan.fairs@…, 17 years ago

Attachment: models.py added

comment:1 by Adrian Holovaty, 17 years ago

Triage Stage: UnreviewedAccepted

Good catch!

comment:2 by Arthur Koziel, 17 years ago

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

python manage.py adminindex polls

Output is:

{% if perms.polls %}
<div class="module"><h2>Polls</h2><table>
    {% if perms.polls.add_poll or perms.polls.change_poll %}
    <tr>
        <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>
    </tr>
    {% endif %}
    {% if perms.polls.add_choice or perms.polls.change_choice %}
    <tr>
        <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>
    </tr>
    {% endif %}
</table></div>
{% endif %}

by Alexander Solovyov, 17 years ago

Attachment: 5286.diff added

force_unicode applied

by Alexander Solovyov, 17 years ago

Attachment: 5286.2.diff added

debug output removed

comment:3 by Alexander Solovyov, 17 years ago

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

Force_unicode applied to lazy element.

comment:4 by Adrian Holovaty, 17 years ago

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