#16611: Contrib.auth.UserManager should allow filtering active/inactive users
-------------------------------------+-------------------------------------
Reporter: | Owner: TomaszZielinski
TomaszZielinski | Status: closed
Type: New | Component: contrib.auth
feature | Severity: Normal
Milestone: | Keywords:
Version: SVN | Has patch: 1
Resolution: wontfix | Needs tests: 0
Triage Stage: Design | Easy pickings: 0
decision needed |
Needs documentation: 0 |
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by jacob):
* status: new => closed
* resolution: => wontfix
Comment:
I'm going to reject this idea; let me try to explain why.
Consider `User.objects.filter(is_active=True)`. It's immediately clear to
anyone with any passing familiarity with Django's model syntax what this
is doing: it's fetching every `User` object whose `is_active` field is set
to `True`. The code itself explains exactly what it's doing.
On the other hand, consider `User.objects.active()`. What does this do?
The code hints that it returns "active" users -- but what does "active"
mean? I'll have to dive into the code or documentation to see that
"active" means "Users who have the is_active flag set to True" and not
"Users who've logged in in the past week" or "Users who are logged into
the site right now" (both perfectly reasonable translations of the word
"active").
Yes, the second form saves about a dozen characters. Always remember,
though: software is read far more often than it's written; saving a few
characters once isn't an acceptable reason to introduce cognitive load
every time that code is read.
Clarity and brevity sometimes are at odds. When they are, I choose
clarity.
--
Ticket URL: <https://code.djangoproject.com/ticket/16611#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.