Opened 5 years ago

Closed 5 years ago

#13372 closed (duplicate)

Field instance copying failes before contribute_to_class

Reported by: paluh Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Python copy.copy() called on Field instance which is not contributed to class (before contribute_to_class call) raises:

AttributeError: 'SomeField' object has no attribute 'model'

This issue is related to #12977 changeset. It has added db.models.Field.__setstate__ method which expects that Field instance has 'model' attribute (but it is initialised in contribute_to_class method). I think that copying of instance should be safe all the time and this problem can be easily fixed by 'hasattr' check. Should I provide patch with test?

Change History (1)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #13366

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