This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Parler Tools extracts applicable methods from aldryn-translation-tools to be used without django-cms


This is a TranslatableModel mixin that automatically generates a suitable slug for the object on save().

If slug_globally_unique is True, then slugs will be required to be unique across all languages.

If slug_globally_unique is False (default), then the strategy used here is that it is OK for two objects to use the same slug if the slugs are for different languages. So if this were used on a translated Article model, these URLs would be valid:

/en/pain - An article in EN about physical discomfort

/fr/pain - An article in FR about bread

Of course, this means that when resolving an object from its URL, care must be taken to factor in the language segment of the URL too.

When using this mixin, it is important to also set the slug_source_field_name property on the implementing model to the name of the translated field which the slug is to be derived from. If you require more slugs to be derived from multiple fields (translated or otherwise), simply override the method get_slug_source to provide the source string for the slug.

Configuration properties


Provide a lazy translated string to use for the default slug should an object not have a source string to derive a slug from.


Provide the name of the translated field in which generated slug shall be stored.


A boolean flag controlling whether slugs are globally unique, or only unique with each language. Default value is False.


Declares the max_length of slugs. This defaults to the max_length of the slug_field and is determined via introspection.


This determines the separator used before any index added to the slug. It does not determine the separator used in the slug itself, which is always -. This is only provided for compatibility with the slugify()“ method in aldryn_common, but it is not recommended to be used. Defaults to -.


Provide the name of the translated field to be used for deriving the slug. If more than one field, or other complex sources are required, override the method get_slug_source() instead. Note that if get_slug_source() is overriden, it is recommended to also override get_slug_default().

Public methods


Naively constructs a translated default slug from the object. For better results, just set the slug_default property on the class to a lazy translated string. Alternatively, override this method if you need to more programmtically determine the default slug.

Example: If your model is “news article” and your source field is “title” this will return “news-article-without-title”.


Accepts an optional parameter idx_len.

Introspects the slug field to determine the maximum length, taking into account a possible separator and up to a [idx_len]-digit number.


Simply returns the value of the slug source field. Override for more complex situations such as using multiple fields (translated or not) as the source.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-parler-tools-0.5.0.tar.gz (5.8 kB) Copy SHA256 Checksum SHA256 Source Aug 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting