#22705: can't bulk create models with no fields
-----------------------------------+--------------------
     Reporter:  ellery-newcomer@…  |      Owner:  nobody
         Type:  Uncategorized      |     Status:  new
    Component:  Uncategorized      |    Version:  1.6
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 I have a model


 {{{
 class Discussion(models.Model): pass
 }}}


 I try to do this:


 {{{
 discussions = [Discussion() for i in range(n)]
 Discussion.objects.bulk_create(discussions)
 }}}

 it fails with

 AttributeError: 'NoneType' object has no attribute 'column'

 because

 django.db.models.sql.compiler.SQLInsertCompiler.as_sql has the following
 line in it:


 {{{
 fields = [None]
 }}}


 which doesn't get tripped on models that have fields, apparently.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22705>
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/069.73e1049ad4a6ad4ee856ec0173392639%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to