AutoSlugField for Django based on django-extensions AutoSlugField, adds option to track foreignkey/parent field for slug.
Project description
AutoSlugField for Django based on django-extensions AutoSlugField, adds option to track foreignkey/parent field for slug.
Installation
Install django-autoslug-field like you would install any other pypi package:
pip install django-autoslug-field
Configuration and usage
add django_autoslug to the list of INSTALLED_APPS in your settings.py
use in models.py:
from django_autoslug.fields import AutoSlugField
…
- class MyModel(models.Model):
lang = models.CharField(_(‘lang’), max_length=50, choices=settings.LANGUAGES) title = models.CharField(_(‘title’), max_length=255) parent = models.ForeignKey(‘MyModel’, blank=True, null=True) slug = AutoSlugField(populate_from=(‘title’,), recursive=’parent’, prefix_from=(‘lang’,), unique=True, max_length=255, overwrite=True)
install http://pypi.python.org/pypi/pytils if you need russian translit support
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-autoslug-field-0.2.tar.gz
.
File metadata
- Download URL: django-autoslug-field-0.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 515a51713f9c12fdbbea2a202b42902374b6e26d7b7a585e6c698df8297e4ba9 |
|
MD5 | 24716f9ffa099c4ea5830b1c62f851a4 |
|
BLAKE2b-256 | 14ad6d9cdf2d8928097284940ba63f3557b2cdf4c9c802e6e5c5f7c81eeb36e5 |