Registry / web-framework / django-autoslug

django-autoslug

JSON →
library1.9.9pypypiunverified

Django-autoslug is a reusable Django library that provides an improved slug field which can automatically: populate itself from another field, preserve uniqueness of the value, and use custom slugify() functions for better internationalization (i18n). The current version is 1.9.9. It maintains an active release cadence with regular updates and compatibility improvements for newer Django and Python versions.

pip install django-autoslug
INSTALL
IMPORT
SIG · DJANGO-AUTOSLUG
D
django-autoslug
web-frameworkpythonv1.9.9
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.9.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AutoSlugField
✓ from autoslug import AutoSlugField
✗ from autoslug.fields import AutoSlugField

Define an `AutoSlugField` in your Django model, specifying the `populate_from` attribute to indicate which field should be used to generate the slug. Ensure `unique=True` if you require unique slugs.

from django.db import models from autoslug import AutoSlugField class Article(models.Model): title = models.CharField(max_length=200) # The slug will be populated from the 'title' field slug = AutoSlugField(populate_from='title', unique=True) def __str__(self): return self.title
Debug
Known issues
breakingVersion 1.9.9 removed support for end-of-life Python & Django versions. Ensure your environment meets the new requirements (Python 3.7+ or PyPy, Django 3.2+).
fix
Upgrade your Python and Django versions to meet the minimum requirements, or pin `django-autoslug` to an older compatible version if necessary.
affects: 1.9.9 and later
breakingIn version 1.9.8, the import path for `FieldDoesNotExist` was moved for compatibility with Django 3.1+. This change may cause import errors in projects using older Django versions with `django-autoslug` 1.9.8 or later.
fix
Ensure your Django version is 3.1 or higher, or use a `django-autoslug` version prior to 1.9.8.
affects: 1.9.8 and later (with Django < 3.1)
breakingVersion 1.9.0 introduced significant backwards incompatible changes, including limiting supported Python/Django versions (initially Python 2.7, 3.5, PyPy; Django 1.7.10+). Additionally, `modeltranslation` support was turned off by default.
fix
Review the release notes for 1.9.0 to adapt your project. Manually enable `modeltranslation` support if required, and ensure your Python/Django versions are within the supported range.
affects: 1.9.0 and later
gotchaWhile `django-autoslug` supports Unicode, it relies on `Unidecode` for robust transliteration. `Unidecode` is not installed as a direct dependency, so if you're dealing with non-ASCII characters, you may encounter issues unless you install `Unidecode` manually (`pip install Unidecode`).
fix
Install `Unidecode` (`pip install Unidecode`) in your project if you need to handle Unicode characters for slug generation.
affects: All versions
gotchaAlways declare the `AutoSlugField` *after* any model fields it references (via `populate_from` or `unique_with`). This ensures that the referenced fields are already processed when the slug is generated.
fix
Reorder your model fields to place the `AutoSlugField` after the fields it depends on.
affects: All versions
gotchaAutomatically updating slugs (especially if `always_update=True` is used) can lead to broken external links or SEO issues if the source fields are frequently changed. Slugs used in public URLs should generally remain stable.
fix
Consider setting `always_update=False` if slug stability is critical for public URLs. Implement 301 redirects if slugs must change for existing content, or use a strategy where slugs are only set on creation and not updated.
affects: All versions
gotchaVersions prior to 1.9.9 could generate slugs that end in a dash or underscore in certain situations.
fix
Upgrade to version 1.9.9 or later to prevent slugs from ending in dashes or underscores.
affects: <1.9.9
Upgrade
Version history
1.9.9latest on PyPI · released Apr 3, 2023
Audit
Dependencies
DjangorequiredCore framework dependency; requires Django 3.2 or higher for version 1.9.9.
UnidecodeoptionalRecommended for proper transliteration of Unicode characters into ASCII slugs, though not a strict dependency. Install separately if needed.
Agent activity
4 hits · last 30 days
node
4
Resources