Skip to main content
https://img.shields.io/github/actions/workflow/status/justinmayer/django-autoslug/main.yml?branch=master https://img.shields.io/pypi/format/django-autoslug.svg https://img.shields.io/pypi/status/django-autoslug.svg https://img.shields.io/pypi/v/django-autoslug.svg https://img.shields.io/pypi/pyversions/django-autoslug.svg https://img.shields.io/pypi/dd/django-autoslug.svg https://readthedocs.org/projects/django-autoslug/badge/?version=latest

Django-autoslug is a reusable Django library that provides an improved slug field which can automatically:

  1. populate itself from another field,

  2. preserve uniqueness of the value and

  3. use custom slugify() functions for better i18n.

The field is highly configurable.

Requirements

Python 3.7+ or PyPy.

Django 3.2 or higher.

It may be possible to successfully use django-autoslug in other environments but they are not tested.

Installation

python -m pip install django-autoslug

Examples

A simple example:

from django.db.models import CharField, Model
from autoslug import AutoSlugField

class Article(Model):
    title = CharField(max_length=200)
    slug = AutoSlugField(populate_from='title')

More complex example:

from django.db.models import CharField, DateField, ForeignKey, Model
from django.contrib.auth.models import User
from autoslug import AutoSlugField

class Article(Model):
    title = CharField(max_length=200)
    pub_date = DateField(auto_now_add=True)
    author = ForeignKey(User)
    slug = AutoSlugField(populate_from=lambda instance: instance.title,
                         unique_with=['author__name', 'pub_date__month'],
                         slugify=lambda value: value.replace(' ','-'))

Documentation

See the complete documentation on ReadTheDocs. It is built automatically for the latest version.

Community

This application is maintained by Justin Mayer. It was initially created by Andy Mikhailenko and then improved by other developers. They are listed in AUTHORS.rst.

Please feel free to file issues and/or submit patches.

See CONTRIBUTING.rst for hints related to the preferred workflow.

Licensing

Django-autoslug is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Django-autoslug is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; see the file COPYING.LESSER. If not, see GNU licenses.

Release files for django-autoslug 1.9.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-autoslug 1.9.9
File Size Uploaded
django-autoslug-1.9.9.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-autoslug 1.9.9
File Interpreter ABI Platform
django_autoslug-1.9.9-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 39.8 kB

Release files / django-autoslug-1.9.9.tar.gz

Download URL django-autoslug-1.9.9.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
79f88e9433c1c88d8d3f2bec60d65ca98bffaff6c072b78aa5fd99d0e84a13dd
BLAKE2b-256 checksum
How to use checksums
6f6e6f454a5287127e03214dfd2df10fbd45df87674528ff73bf1fbb3536cdb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / django_autoslug-1.9.9-py2.py3-none-any.whl

Download URL django_autoslug-1.9.9-py2.py3-none-any.whl
Size 14.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
81cb018944498f27f439d439687cf902212cafbdb8c74c8ca0307543a3d82907
BLAKE2b-256 checksum
How to use checksums
875c37bed8c69ad42002a37ba161245342ca15f78a43c75b025ac465d696294c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.9.9 This release

2 release files

1.9.8

2 release files

1.9.7

2 release files

1.9.6

2 release files

1.9.5

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.0

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.7.0

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.9

1 release file

1.3.8

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

2 release files

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page