This section contains information, including examples, about how to use django-primary-slug in your existing Django projects or applications.
This model field is an enhanced version of Django’s SlugField.
django-primary-slug provides an enhanced version of the default Django’s SlugField, which supports:
The PrimarySlugField derives from the default SlugField and thus all attributes and methods of the default SlugField are inherited.
In addition to the default arguments, the PrimarySlugField also supports the following:
The following code snippet illustrates how to use the PrimarySlugField:
from django.db import models
from primary_slug.fields import PrimarySlugField
class MyModel(models.Model):
title = models.CharField(max_length=160)
slug = PrimarySlugField(populate_from='title', max_length=160)