Opened 8 months ago

Last modified 8 months ago

#35350 closed Bug

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

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

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.

Change History (2)

by Matt Hegarty, 8 months ago

Attachment: sample.csv added

sample csv for import

by Matt Hegarty, 8 months ago

Attachment: st1.txt added

stack trace

Note: See TracTickets for help on using tickets.
Back to Top