Opened 5 years ago

Closed 3 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 4 years ago.
14516.removetags-slugify-utils.diff (4.8 KB) - added by julien 4 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 4 years ago by dmoisset

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by ik

  • Owner changed from nobody to ik

Changed 4 years ago by ik

comment:3 Changed 4 years ago by ik

  • Has patch set
  • Needs tests unset

comment:4 Changed 4 years ago by julien

  • milestone 1.3 deleted

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 Changed 4 years ago by julien

  • milestone set to 1.4

comment:6 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to New feature

Changed 4 years ago by julien

comment:7 Changed 4 years ago by julien

  • 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 Changed 4 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

comment:2 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

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

  • Resolution set to fixed
  • Status changed from new to closed

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