Opened 6 months ago

Last modified 5 months ago

#35350 closed Bug

Crash on write of new instance when using GeneratedField — at Version 1

Reported by: Matt Hegarty Owned by: nobody
Component: Database layer (models, ORM) Version: 5.0
Severity: Release blocker Keywords: GeneratedField
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Matt Hegarty)

We have an issue in django-import-export where imports of new instances fails when the model has a GeneratedField.

This occurs when an instance is being created which doesn't already exist in the database, which the docs imply is supported by GeneratedField:

A stored generated column is computed when it is written (inserted or updated)

The stack trace is attached.

Steps to reproduce:

  1. Clone this repo and use the 'issue-1779-generatedfield' branch.
  2. Create a venv
  3. Install the example app following the instructions here
  4. Navigate to "Books", click "Import", then select the attached sample.csv file.
  5. Click "Submit" and you will see the error.
  • python 3.12
  • django 5.0.3

Change History (3)

by Matt Hegarty, 6 months ago

Attachment: sample.csv added

sample csv for import

by Matt Hegarty, 6 months ago

Attachment: st1.txt added

stack trace

comment:1 by Matt Hegarty, 6 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top