#23676 closed Cleanup/optimization (fixed)
FileField documentation is confusing about database column representation
Reported by: | Jon Dufresne | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation for the model field FileField
contains the following line:
By default, FileField instances are created as varchar(100) columns in your database.
Personally I find the intent of this sentence confusing. The phrase "by default", leads me to believe this is something I can modify. Yet, I find no documentation on how to modify this. I was looking for a way to modify the FileField
to be represented as a FK to a custom FileMetadata
model. This gave me hope that it was possible. Upon looking for more documentation and looking at the source, I did not find any clear guidance on how to approach this.
It seems this should be more of a direct statement by dropping "by default":
FileField instances are created as varchar(100) columns in your database.
Change History (8)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 10 years ago
I think what's trying to be implied is that you can customize the length using the max_length option.
I agree. I think with the "by default" removed the second sentence does a fine job of explaining that:
FileField instances are created as varchar(100) columns in your database. As with other fields, you can change the maximum length using the max_length argument.
comment:3 by , 10 years ago
What about the following which emphasizes that the "by default" is for the length only
FileField instances are created as varchar columns with a default length 100 in your database. As with other fields, you can change the maximum length using the max_length argument.
comment:4 by , 10 years ago
Makes sense to me. I'd just change the order a bit: "FileField instances are created in your database as varchar columns with a default max length of 100 characters."
comment:5 by , 10 years ago
Thanks. I've incorporated your suggestions in a pull request <https://github.com/django/django/pull/3384>.
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I think what's trying to be implied is that you can customize the length using the
max_length
option.