Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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 Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

I think what's trying to be implied is that you can customize the length using the max_length option.

comment:2 by Jon Dufresne, 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 Jon Dufresne, 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 Tim Graham, 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 Jon Dufresne, 10 years ago

Thanks. I've incorporated your suggestions in a pull request <https://github.com/django/django/pull/3384>.

comment:6 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In c1b9f99a812d01124ba4ddefcafaa90dcb5b05ae:

Fixed #23676 -- Rearranged sentence; "by default" applies only to max length

comment:7 by Tim Graham <timograham@…>, 10 years ago

In 7d90fed1a073318defbb7cf80015530a38a09bbc:

[1.6.x] Fixed #23676 -- Rearranged sentence; "by default" applies only to max length

Backport of c1b9f99a81 from master

comment:8 by Tim Graham <timograham@…>, 10 years ago

In 37ab955d69ea541b4c66e225cc24dc0a2ee057be:

[1.7.x] Fixed #23676 -- Rearranged sentence; "by default" applies only to max length

Backport of c1b9f99a81 from master

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