This package is used to automatically create unique slugs.
Install
pip install django-easy-autoslug
Usage
Basic example
# models.py
from django_autoslugfield import AutoSlugField
class Item(models.Model):
title = models.CharField(max_length=255)
slug = AutoSlugField(max_length=255, unique=True)
Slug is created from __str__ method. If another object with same slug already exists slug will be suffixed with number -2, -3 …
Advanced usage
AutoSlugField arguments are:
reserve_chars - number of characters reserved for suffix (including sparator -)
title_field - use specific field instread of __str__ method
in_respect_to - generate unique slug for specific subset of fields
Following code can create same slug for another month / year.
from django_autoslugfield import AutoSlugField
class Blog(models.Model):
title = models.CharField(max_length=255)
slug = AutoSlugField(filter_fields=('year', 'month'), max_length=255)
year = models.IntegerField()
month = models.IntegerField()
class Meta:
unique_together = ('slug', 'year', 'month')
Metadata
Release files for django-easy-autoslug 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_easy_autoslug-1.0.5.tar.gz | 14.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_easy_autoslug-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / django_easy_autoslug-1.0.5.tar.gz
| Download URL | django_easy_autoslug-1.0.5.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f28a4ad0e1736c59aa0bcf16afdee00400ee28ed70edad3012aace3bcb549dbd
|
|
BLAKE2b-256 checksum How to use checksums |
11c19dc8d4ffa80558893beb9d568fef18a650af17743a3cb31e13369cecb212
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.20
|
Release files / django_easy_autoslug-1.0.5-py3-none-any.whl
| Download URL | django_easy_autoslug-1.0.5-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd4cb3e9ca09a60a0aeb364d1d09a55a9b44b10d4ab733757bcde075686ee324
|
|
BLAKE2b-256 checksum How to use checksums |
9f02289b876562ba1f1041f5b861132ba22a68f9409b0bcc1cbd88a62e301911
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.20
|
Security for django-easy-autoslug 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.