django-extended-choices
django-extended-choices copied to clipboard
Little helper application to improve django choices (for fields)
Hi, Thank you for creating this library. `django-extended-choices` is a very convenient and good library. Change Summary * support Python 3.8.0 and Django3.0. and update toxenv and travis-ci config. Thanks
Fixes #53
before: after:
PyCharm code inspection highlights all choices. Example: ```python STATES = Choices( ('ONLINE', 1, 'Online'), ('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline'), ) ``` Inspection info: `Expected type 'list', got 'Tuple[str, int,...
If the constant starts with a numeral (potentially other non-alpha too), the CHOICES. construct doesn't work. Steps to reproduce. ``` >>> STATES = Choices(('ONLINE','1-2', 'Online'),('OFFLINE','2-1', 'Offline'),) >>> STATES.constants {'ONLINE': ('ONLINE',...
Steps to reproduce: ``` >>> from collections import OrderedDict >>> from django.utils import translation >>> from django.utils.translation import gettext_lazy as _ >>> from extended_choices import Choices >>> STATES = Choices(...
Version 1.2 will add a few features and support for django 2 (with same support for previous versions. Then version 2 will follow, supporting only python 3.
Something like ```python class States(Choices): ONLINE = (1, 'Online') DRAFT = (2, 'Draft') OFFLINE = (3, 'Offline') ``` An attribute could accept a tuple, as above, or a single value,...