Opened 15 years ago
Closed 15 years ago
#13372 closed (duplicate)
Field instance copying failes before contribute_to_class
Reported by: | paluh | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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?
Note:
See TracTickets
for help on using tickets.
Duplicate of #13366