#23112: Field.get_choices tries to index an iterable
-------------------------------------+-------------------------------------
     Reporter:  bernie_sumption      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.7-rc-2
  (models, ORM)                      |               Resolution:
     Severity:  Release blocker      |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by zsiciarz):

 I got bitten by this bug too (talked about it yesterday with Baptiste).
 Here's a traceback from my project which used to work on RC1, breaks on
 RC2.

 {{{
 Traceback (most recent call last):
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/core/management/__init__.py", line 354, in execute
     django.setup()
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/__init__.py", line 21, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/apps/registry.py", line 115, in populate
     app_config.ready()
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/contrib/admin/apps.py", line 22, in ready
     self.module.autodiscover()
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/contrib/admin/__init__.py", line 23, in autodiscover
     autodiscover_modules('admin', register_to=site)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/utils/module_loading.py", line 74, in autodiscover_modules
     import_module('%s.%s' % (app_config.name, module_to_search))
   File
 "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/importlib/__init__.py",
 line 90, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
   File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
   File "<frozen importlib._bootstrap>", line 1532, in
 _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
   File "<frozen importlib._bootstrap>", line 1022, in load_module
   File "<frozen importlib._bootstrap>", line 1003, in load_module
   File "<frozen importlib._bootstrap>", line 560, in
 module_for_loader_wrapper
   File "<frozen importlib._bootstrap>", line 868, in _load_module
   File "<frozen importlib._bootstrap>", line 313, in
 _call_with_frames_removed
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/allauth/socialaccount/admin.py", line 12, in <module>
     class SocialAppForm(forms.ModelForm):
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/forms/models.py", line 284, in __new__
     opts.help_texts, opts.error_messages)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/forms/models.py", line 210, in fields_for_model
     formfield = f.formfield(**kwargs)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/db/models/fields/__init__.py", line 1063, in formfield
     return super(CharField, self).formfield(**defaults)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/db/models/fields/__init__.py", line 822, in formfield
     defaults['choices'] = self.get_choices(include_blank=include_blank)
   File "/home/zbigniewsiciarz/v/bazawiedzy/lib/python3.3/site-
 packages/django/db/models/fields/__init__.py", line 733, in get_choices
     named_groups = self.choices and isinstance(self.choices[0][1], (list,
 tuple))
 TypeError: 'itertools._tee' object is not subscriptable

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23112#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.0cf329aaa22988362a9d99695572958a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to