Skip to main content

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

Project description

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:

History

0.1.1 (2021-10-07)

  • First release on PyPI.

0.1.2 (2021-09-07)

  • Rework on Mixin to work only on py3

0.1.3 (2021-10-07)

  • Rework configurations and README

0.1.4 (2021-10-07)

  • Rework configurations and added github actions

0.1.5 (2021-10-07)

  • Added pipy on github actions and fixed setup.py

0.1.6 (2021-10-07)

  • Changed from test.pipy.org to pipy.org

0.1.7 (2021-10-07)

  • Updated github action

0.1.7 (2021-10-07)

  • Updated github action

0.1.8 (2021-10-19)

  • Updated version for github actions and changed name to django-slug-model-mixin

0.1.9 (2021-10-19)

  • Updated version for github actions

0.2.0 (2021-11-22)

  • Fixed slug with spaces bug

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

django-slug-model-mixin-0.3.0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

django_slug_model_mixin-0.3.0-py2.py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page