Opened 14 years ago

Closed 12 years ago

#14516 closed New feature (fixed)

Extract methods from removetags and slugify template filters

Reported by: romainh Owned by: ik
Component: Template system Version:
Severity: Normal Keywords: striptags removetags slugify refactor
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Like striptags template filter, removetags and slugify should rely on external methods located in django.utils.
removetags method should live in django.utils.html like striptags.

Those features are often used elsewhere than in templates.

Attachments (2)

14516.diff (3.3 KB ) - added by ik 14 years ago.
14516.removetags-slugify-utils.diff (4.8 KB ) - added by Julien Phalip 14 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Daniel F Moisset, 14 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 by ik, 14 years ago

Owner: changed from nobody to ik

by ik, 14 years ago

Attachment: 14516.diff added

comment:3 by ik, 14 years ago

Has patch: set
Needs tests: unset

comment:4 by Julien Phalip, 14 years ago

milestone: 1.3

I agree with the reporter that those templatetags should also be available as normal python functions.

django.utils.html is probably a good home for removetags, however slugify is not really an HTML thing so it should be in another module (to be determined).

Removing from the 1.3 milestone since we're pretty close to releasing it, and this can be assimilated as a new feature request. It's easy enough to live with using those templatetags for the moment.

comment:5 by Julien Phalip, 14 years ago

milestone: 1.4

comment:6 by Julien Phalip, 14 years ago

Severity: Normal
Type: New feature

by Julien Phalip, 14 years ago

comment:7 by Julien Phalip, 14 years ago

Easy pickings: unset

I moved Slugify to django.utils.text. I'm unsure whether this needs to be documented since currently only the "stable" modules are: http://docs.djangoproject.com/en/dev/ref/utils/

Perhaps the doc should be updated to include all (or some) other "non-stable" modules and the "stable" modules should be highlighted as such.

comment:8 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

comment:2 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:3 by Andrew Godwin <andrew@…>, 12 years ago

Resolution: fixed
Status: newclosed

In [212b9826bdda5c3c2eb680e6f9c5b046b4172300]:

Fixed #14516 -- Extract methods from removetags and slugify template filters

Patch by @jphalip updated to apply, documentation and release notes
added.

I've documented strip_tags as well as remove_tags as the difference
between the two wouldn't be immediately obvious.

Note: See TracTickets for help on using tickets.
Back to Top