# 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+
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+
Metadata
Release files for choices.py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| choices.py-0.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| choices.py-0.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / choices.py-0.1.0.tar.gz
| Download URL | choices.py-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17d875bb5579127fbb65f966e3906295d644c7f5ac1ce76ab599deb8dbd5829d
|
|
BLAKE2b-256 checksum How to use checksums |
caa1788aa45e832db51229f9b0ec3744192d4b48016ffff66c367c520f4cb34e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / choices.py-0.1.0-py2.py3-none-any.whl
| Download URL | choices.py-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
54aed8b984d5f6a783f6c2e300a331c2bdcd36326facd3af9cc2efe7d2b65c11
|
|
BLAKE2b-256 checksum How to use checksums |
e342b711a7e7099facea592734ae8f9b0a64550772c62035ed9fb2dcdd9265f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |