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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file django-slug-model-mixin-0.3.0.tar.gz.

File metadata

File hashes

Hashes for django-slug-model-mixin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1cf7bfc7bd491a81ad21a845673531e3d53db4f08edb02d65c4cda57d823f02e
MD5 6e2399e2e228791269e733f5c7093b79
BLAKE2b-256 39401a8cfc76c5df244b429e3d891d7a11cc7a90001eac81de4b641bd54f993f

See more details on using hashes here.

File details

Details for the file django_slug_model_mixin-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_slug_model_mixin-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4a2fc42f5569f3f2624a5ea60654b0591e65e7c2ba399e8bba7c9bf8b430d7d0
MD5 0e45cbd19197026f1f3e81844f91067c
BLAKE2b-256 c6d06d1f9bdedbf5203fb81c9eccc1869161d087d75f71feb55e7bcd5c260c12

See more details on using hashes here.

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