#5025: Add a "truncate" template filter
---------------------------------------+---------------------------------
Reporter: SmileyChris | Owner: nobody
Type: New feature | Status: reopened
Milestone: | Component: Template system
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
---------------------------------------+---------------------------------
Comment (by jezdez):
Replying to [comment:34 SmileyChris]:
> Thanks for the review, Jannis.
>
> * do we still need pgettext if it's `'%(truncated_text)s...'`?
Yes, pgettext is still useful in the sense that it gives a hint to the
translators where it's going to be used.
> * the naming seems to reflect the current naming of
`truncate_words`/`truncatewords`, why is that weird?
Adding two new functions with almost the same name for a feature that is
almost exactly implemented in a different tag and function doesn't make it
an awful naming to you?
> * i'm not sure what you mean by extending the `truncate` filter - what
`truncate` filter?
Apologies, I meant the `truncatewords` filter. IMO, both serve the same
purpose: truncate a string. Couldn't we combine the utility function?
> * just about every template filter in defaultfilters has an inline
import - should this patch refactor them all or are we setting a new
precident?
Nope, fixing that is a matter of another ticket, I assume this was once
done because of import dependencies, but there is no reason to keep
following that path, as far as I can see it.
--
Ticket URL: <https://code.djangoproject.com/ticket/5025#comment:35>
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.