Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#16854 closed Bug (fixed)

AttributeError on syncdb

Reported by: desh Owned by: nobody
Component: Core (Management commands) Version: master
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 desh 4 years ago.
Initial patch against current git head (9323daf2)

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by desh

Initial patch against current git head (9323daf2)

comment:1 Changed 4 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 4 years ago by carljm

  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.3 to SVN

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 Changed 4 years ago by desh

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 Changed 4 years ago by Alex

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

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