Opened 10 years ago
Last modified 10 years ago
#24368 closed Uncategorized
FileField needlessly serializes upload_to; same problems with some other fields — at Initial Version
Reported by: | Roman Odaisky | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | 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
django.db.models.fields.FileField explicitly includes upload_to in the serialization process. This takes no part in the actual migration process but causes errors if the value of the field is a lambda function. Instead, the deconstruct() functions for FileField and other fields should only serialize arguments relevant to subsequent ALTER commands issued to the DBMS.
Other places where this problem arises include ForeignKey.limit_choices_to — do changes to this attribute mandate a new migration and is it appropriate to have it fail if the value is a lambda?
Once fixed, #22351 can be reverted.