Metadata-Version: 2.0
Name: choices.py
Version: 0.1.0
Summary: A wrapper around Django's choices.
Home-page: https://github.com/orlnub123/choices.py
Author: orlnub123
Author-email: UNKNOWN
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities

# choices.py

choices.py is a wrapper around Django's choices to make them easier to use.

## Example

```py
from django.db import models

from choices import Choices


class Student(models.Model):

    class Year(Choices):
        FRESHMAN = 'FR'
        SOPHOMORE = 'SO'
        JUNIOR = 'JR'
        SENIOR = 'SR'

        @property
        def is_upperclass(self):
            return self in (self.JUNIOR, self.SENIOR)

    year_in_school = models.CharField(max_length=2, choices=Year.choices(),
                                      default=Year.FRESHMAN.value)

    def is_upperclass(self):
        return self.Year(self.year_in_school).is_upperclass
```

## Installing

Install it from [PyPI](https://pypi.org/project/choices.py/) with pip:

```
pip install choices.py
```

**Requirements:**
- Python 3.4+


