Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16854 closed Bug (fixed)

AttributeError on syncdb

Reported by: Nikolay Zakharov Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: syncdb management contenttypes
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


When one have stale content types and trying to do syncdb, following error occurs:

Creating tables ...
Traceback (most recent call last):
  File "./", line 9, in <module>
... traceback
  File "/usr/lib/python2.6/dist-packages/django/contrib/contenttypes/", line 47, in update_contenttypes
    content_type_display = '\n'.join(['    %s | %s' % (ct.app_label, ct.model) for ct in content_types])
AttributeError: 'unicode' object has no attribute 'app_label'

This is because of type mismatch in list comprehension: content_types was list of objects, but now it is a dict with app_labels as keys and models as values.

Attachments (1)

patch_for_16854.diff (845 bytes ) - added by Nikolay Zakharov 13 years ago.
Initial patch against current git head (9323daf2)

Download all attachments as: .zip

Change History (5)

by Nikolay Zakharov, 13 years ago

Attachment: patch_for_16854.diff added

Initial patch against current git head (9323daf2)

comment:1 by Alex Gaynor, 13 years ago

This was marked as version 1.3, however I suspect that this is a regression on trunk, is that correct?

comment:2 by Carl Meyer, 13 years ago

Triage Stage: UnreviewedAccepted
Version: 1.3SVN

It's pretty clear from looking at the relevant code that this is only on trunk, introduced in r16739. Accepting.

desh, if you are actually seeing it on 1.3 please note that.

comment:3 by Nikolay Zakharov, 13 years ago

That is correct, guys, it is only in the current SVN trunk and regression was introduced by commit at 09-09-2011.
Version was overlooked by me ('1.3' was default value).
Nice, seems that our company packaging bleeding edge trunk.

comment:4 by Alex Gaynor, 13 years ago

Resolution: fixed
Status: newclosed

In [16832]:

Fixed #16854 -- corrected an AttributeError coming from the contenttypes post-syncdb hook. Thanks to desh for the report.

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