Skip to main content

inflect_dj.py

NAME

inflect_dj.py - Generate plurals for use with Django.

VERSION

This document describes version 0.2.0 of inflect_dj.py

INSTALLATION

pip install inflect_dj

or

easy_install inflect_dj

DESCRIPTION

@verbose_name_plural —

Decorator for the Django models.Model classes.

Decorating a child class of model.Model with @verbose_name_plural will ensure that the plural form of the model name will be rendered correctly.

It uses the module inflect.py to determine the correct pluralisation.

USAGE

  1. Using @verbose_name_plural when specifying a verbose_name for the model:

    from django.db import models
    from inflect_dj import verbose_name_plural
    
    @verbose_name_plural
    class mycategory(models.Model):
        [definition of the model]
        class Meta:
            verbose_name = 'category'
            [rest of the Meta class definition]

The plural will be displayed correctly as categories.

  1. Using @verbose_name_plural without specifying verbose_name:

    from django.db import models
    from inflect_dj import verbose_name_plural
    
    @verbose_name_plural
    class category(models.Model):
        [definition of the model]
        class Meta:
            [class Meta definition]

The plural will be displayed correctly as categories, as this is the plural of the class name.

Earlier versions of Python

If you are using a Python version earlier than 2.6 you cannot use class decorators and must explicitly redefine the class with a call to verbose_name_plural():

from django.db import models
from inflect_dj import verbose_name_plural

class mycategory(models.Model):
    [definition of the model]
    class Meta:
        verbose_name = 'category'
        [rest of the Meta class definition]
mycategory = verbose_name_plural(mycategory)

AUTHOR

Paul Dyson (pwdyson@yahoo.com)

Metadata

Release files for inflect_dj v0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inflect_dj v0.2.0
File Size Uploaded Provenance Actions
inflect_dj-v0.2.0.tar.gz 14.7 kB Without provenance Details for inflect_dj-v0.2.0.tar.gz

Release files / inflect_dj-v0.2.0.tar.gz

Download URL inflect_dj-v0.2.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
96d71aadbfd934657cc54f23baa22d24e49c8ff74eb077f089fc6bb372c55cf7
BLAKE2b-256 checksum
How to use checksums
b5ea9d360cb1faf566fa0c59094958a02d4b423cf9f2e2471e206457afdac49c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for inflect_dj v0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page