[Django] #23676: FileField documentation is confusing about database column representation

5 views
Skip to first unread message

Django

unread,
Oct 17, 2014, 3:54:37 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
-------------------------------+--------------------
Reporter: jdufresne | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/23676>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 17, 2014, 4:23:30 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* type: Uncategorized => Cleanup/optimization
* needs_tests: => 0
* needs_docs: => 0


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:1>

Django

unread,
Oct 17, 2014, 4:49:52 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by jdufresne):

> 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:2>

Django

unread,
Oct 17, 2014, 5:27:45 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by jdufresne):

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:3>

Django

unread,
Oct 17, 2014, 8:08:54 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

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."

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:4>

Django

unread,
Oct 17, 2014, 9:18:13 PM10/17/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by jdufresne):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:5>

Django

unread,
Oct 18, 2014, 6:56:10 AM10/18/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"c1b9f99a812d01124ba4ddefcafaa90dcb5b05ae"]:
{{{
#!CommitTicketReference repository=""
revision="c1b9f99a812d01124ba4ddefcafaa90dcb5b05ae"
Fixed #23676 -- Rearranged sentence; "by default" applies only to max
length
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:6>

Django

unread,
Oct 18, 2014, 6:56:27 AM10/18/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"7d90fed1a073318defbb7cf80015530a38a09bbc"]:
{{{
#!CommitTicketReference repository=""
revision="7d90fed1a073318defbb7cf80015530a38a09bbc"
[1.6.x] Fixed #23676 -- Rearranged sentence; "by default" applies only to
max length

Backport of c1b9f99a81 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:7>

Django

unread,
Oct 18, 2014, 6:56:28 AM10/18/14
to django-...@googlegroups.com
#23676: FileField documentation is confusing about database column representation
--------------------------------------+------------------------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"37ab955d69ea541b4c66e225cc24dc0a2ee057be"]:
{{{
#!CommitTicketReference repository=""
revision="37ab955d69ea541b4c66e225cc24dc0a2ee057be"
[1.7.x] Fixed #23676 -- Rearranged sentence; "by default" applies only to
max length

Backport of c1b9f99a81 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23676#comment:8>

Reply all
Reply to author
Forward
0 new messages