Opened 10 months ago

Last modified 28 hours ago

#22705 assigned Bug

can't bulk create models with no fields

Reported by: ellery-newcomer@… Owned by: chrisjluc
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have a model

class Discussion(models.Model): pass

I try to do this:

discussions = [Discussion() for i in range(n)]

it fails with

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


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.

Attachments (1)

22705-test.diff (1.2 KB) - added by timo 10 months ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 10 months ago by timo

  • Component changed from Uncategorized to Database layer (models, ORM)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

Can reproduce with the attached test for Django's test suite.

Changed 10 months ago by timo

comment:2 Changed 28 hours ago by chrisjluc

  • Owner changed from nobody to chrisjluc
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.
Back to Top