#29654 closed Cleanup/optimization (fixed)
Truncate should use horizontal ellipsis character instead of three dots
| Reported by: | Sudhanshu Mishra | Owned by: | nobody |
|---|---|---|---|
| Component: | Utilities | Version: | dev |
| Severity: | Normal | Keywords: | string, truncator |
| Cc: | Dan Davis | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
In the following example the value returns a string which has a length of 18 and including 3 dots.
>>> from django.utils.text import Truncator
>>> Truncator("Hello world is not so long").chars(18)
'Hello world is ...'
>>> Truncator("Hello world is not so long").chars(18)[-1]
'.'
IMHO, the Truncator should use ... (ellipsis) character instead.
Change History (13)
comment:1 by , 7 years ago
| Has patch: | set |
|---|
comment:2 by , 7 years ago
| Component: | Template system → Utilities |
|---|---|
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Accepted |
| UI/UX: | unset |
| Version: | 2.1 → master |
comment:3 by , 7 years ago
But there are many more occurrences in the Django source code and comments. We should be consistent. Does this need a discussion?
comment:4 by , 7 years ago
Sudhanshu,
Do you mean the expected output should be like below :
>>> Truncator("Hello world is not so long").chars(18)[-1]
'...'
comment:6 by , 7 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:10 by , 7 years ago
There have been some reports of the ellipses causing crashes on the shell (#30184) so parts of this might be reverted.
comment:11 by , 7 years ago
| Cc: | added |
|---|
Note:
See TracTickets
for help on using tickets.
I'd be in favour of this change.
PR