[Django] #21730: Small confusion code example in documentation

4 views
Skip to first unread message

Django

unread,
Jan 3, 2014, 11:17:26 PM1/3/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
-------------------------------+--------------------
Reporter: rafalp | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------
The code example on following page:

https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.USERNAME_FIELD

sets both unique=True and db_index=True attributes on model field, yet
documentation for unique attribute claims thats not necessary:

https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.unique

"Note that when unique is True, you don’t need to specify db_index,
because unique implies the creation of an index."

This gave me small scare, so I'm reporting it to bring it up to the doc
maintainers attention. ;)

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

Django

unread,
Jan 4, 2014, 5:29:02 AM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
-------------------------------+--------------------------------------
Reporter: rafalp | Owner: nobody
Type: Uncategorized | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0


Comment:

I'm not sure I understand - what exactly about this is scary? It's just
saying that adding db_index=True is redundant if you've also specified
unique=True.

Closing needsinfo; if you can suggest better language, or can provide a
pointer about what exactly is "scary" about the current language, please
reopen.

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

Django

unread,
Jan 4, 2014, 5:52:49 AM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
-------------------------------+--------------------------------------

Reporter: rafalp | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

Well it's still necessary to remove the redundant db_index. AFAIK it
creates a second index that wastes space without any benefit.

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

Django

unread,
Jan 4, 2014, 6:33:58 AM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
--------------------------------------+------------------------------------
Reporter: rafalp | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


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

Django

unread,
Jan 4, 2014, 10:13:05 AM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
--------------------------------------+------------------------------------
Reporter: rafalp | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: fixed

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

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed

* resolution: => fixed


Comment:

In [changeset:"c717ebbfecd248d1a0ffeffa6d167109936fbe3f"]:
{{{
#!CommitTicketReference repository=""
revision="c717ebbfecd248d1a0ffeffa6d167109936fbe3f"
Fixed #21730 -- Removed superfluous db_index in custom auth docs

Thanks rafalp for the report.
}}}

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

Django

unread,
Jan 4, 2014, 10:14:03 AM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
--------------------------------------+------------------------------------
Reporter: rafalp | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6

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

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

Comment (by Claude Paroz <claude@…>):

In [changeset:"5d99cd6877377824a6a5de92475ad0572ab6fb0f"]:
{{{
#!CommitTicketReference repository=""
revision="5d99cd6877377824a6a5de92475ad0572ab6fb0f"
[1.6.x] Fixed #21730 -- Removed superfluous db_index in custom auth docs

Thanks rafalp for the report.

Backport of c717ebbfec from master.
}}}

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

Django

unread,
Jan 4, 2014, 1:27:20 PM1/4/14
to django-...@googlegroups.com
#21730: Small confusion code example in documentation
--------------------------------------+------------------------------------
Reporter: rafalp | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.6

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

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

Comment (by rafalp):

Replying to [comment:1 russellm]:


> I'm not sure I understand - what exactly about this is scary? It's just
saying that adding db_index=True is redundant if you've also specified
unique=True.

It gave me scare because it made me question if my model definitions are
doing what I was thinking they are doing. Rest assured, its not a comment
about quality of documentation or anything like that ;)

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

Reply all
Reply to author
Forward
0 new messages