Django Slug Model Mixin

https://badge.fury.io/py/django-slug-model-mixin.svg https://readthedocs.org/projects/pip/badge/?version=latest&style=flat-square Coverage Status

Slugify model mixin to manage slugged fields in your project models.

Documentation

The full documentation is at https://django-slug-model-mixin.readthedocs.io.

Quickstart

Install Django Slug Model Mixin:

pip install django-slug-model-mixin

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'slug_model_mixin',
    ...
)

Use the SlugModelMixin in your model:

class ExampleModel(SlugModelMixin, models.Model):
    slugged_field = 'name'  # insert the name of the field you want to slugify
    slug_unique = False # remove unique for your slug
    force_slugify = True # force the slugify using uuslug

    name = models.CharField(
        'Name',
        max_length=255
    )

class Meta:
    verbose_name = 'Example Model'
    verbose_name_plural = 'Example Models'

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

Credits

Tools used in rendering this package: