Django

Code

Ticket #12651 (new)

Opened 6 months ago

Last modified 1 week ago

AutoSlugField, that can recreate unique slugs during saving.

Reported by: Ciantic Assigned to: nobody
Milestone: Component: Uncategorized
Version: Keywords:
Cc: jacob@jmagnusson.com Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 1

Description

Hi!

I would like to see something that can create unique slugs during saving of the model like AutoSlugField by GaretJax in djangosnippets. That specific implementation might be too simple and not enough configurable, but if it were improved a little perhaps? There are several slug hacks in djangosnippets alone that tries to implement unique slugs, with varying results.

Naturally it should be part of Django since it is used by almost every project and every model. Housing fleet of utility libraries is not the nicest way to implement programs, I have stumbled with that a lot in the past.

Attachments

Change History

01/20/10 12:36:55 changed by Ciantic

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

I just remixed some code and created a ''new'' AutoSlugField, which too must be improved but it works for me now.

02/08/10 13:03:01 changed by Ciantic

There is also one in django-extensions but these utility libraries has been weak in past as the maintainers tend to loose interest.

One idea would perhaps to officially support/maintain some extension library, a bit in same way as WPF (Windows Presentation Foundation) has put up a WPF Toolkit where features trickles down after maturing to real .NET.

02/10/10 03:50:28 changed by russellm

  • needs_better_patch set to 1.
  • needs_tests set to 1.
  • version deleted.
  • milestone deleted.
  • has_patch set to 1.
  • stage changed from Unreviewed to Design decision needed.

Hyperbole in the ticket description aside, an AutoSlugField? that sounds like a reasonable idea. The issue is finding an implementation that is acceptable. I'm not wild about the idea of an model save that will spawn a flood of queries back on the database trying to find a unique slug. This needs further discussion.

07/22/10 11:20:46 changed by JMagnusson

  • cc set to jacob@jmagnusson.com.

Add/Change #12651 (AutoSlugField, that can recreate unique slugs during saving.)




Change Properties
Action