Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.82 KB

README.rst

File metadata and controls

50 lines (39 loc) · 1.82 KB
https://img.shields.io/github/actions/workflow/status/amateja/django-bitoptions/python-test.yml

django-bitoptions

This project replaces several related BooleanFields with a single field and a few eye candy features.

installation

pip install django-bitoptions

usage

from django.db import models
from bitoptions import BitOptions, BitOptionsField

TOPPINGS = BitOptions(
    ('pepperoni', 'mushrooms', 'onions', 'sausage', 'bacon',
     'black olives', 'green olives', 'green peppers', 'pineapple',
     'spinach', 'tomatoes', 'broccoli', 'jalapeno peppers', 'anchovies',
     'chicken', 'beef', 'ham', 'salami')
)
CHEESES = BitOptions(('feta', 'parmesan', 'provolone', 'goat',
                      'mozzarella'))


class Pizza(models.Model):
    toppings = BitOptionsField(options=TOPPINGS)
    cheeses = BitOptionsField(options=CHEESES)