summaryrefslogtreecommitdiff
path: root/tests/model_enums
Commit message (Collapse)AuthorAgeFilesLines
* Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.11.4+.Mariusz Felisiak2023-04-071-6/+1
| | | | | https://github.com/python/cpython/commit/5342f5e713e0cc45b6f226d2d053a8cde1b4d68e Follow up to 38e63c9e61152682f3ff982c85a73793ab6d3267.
* Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python 3.12+.Mariusz Felisiak2023-04-051-1/+5
| | | https://github.com/python/cpython/commit/2a4d8c0a9e88f45047da640ce5a92b304d2d39b1
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-071-109/+138
|
* Refs #32074 -- Backported Enum.__repr__() from Python 3.10.Mariusz Felisiak2021-04-071-2/+2
| | | | | | Enum.__repr__() was changed in [1], we should use the same format in Python < 3.10. [1] https://bugs.python.org/issue40066
* Fixed #32460 -- Allowed "label"/"do_not_call_in_templates" members in model ↵Nick Pope2021-03-241-0/+20
| | | | choice enums.
* Refs #32460 -- Doc'd and tested that property names of model choice enums ↵Nick Pope2021-03-241-0/+4
| | | | cannot be used as members.
* Fixed #31154 -- Added support for using enumeration types in templates.Adam Johnson2020-01-101-0/+6
| | | | | | | Enumeration helpers are callables, so the template system tried to call them with no arguments. Thanks Rupert Baker for helping discover this.
* Used more specific unittest assertions in tests.Nick Pope2019-10-291-2/+2
| | | | | | | | | | | | * assertIsNone()/assertIsNotNone() instead of comparing to None. * assertLess() for < comparisons. * assertIs() for 'is' expressions. * assertIsInstance() for isinstance() expressions. * rounding of assertAlmostEqual() for round() expressions. * assertIs(..., True/False) instead of comparing to True/False. * assertIs()/assertIsNot() for ==/!= comparisons. * assertNotEqual() for == comparisons. * assertTrue()/assertFalse() instead of comparing to True/False.
* Fixed #30902 -- Added __str__() for model choice enums.Carlton Gibson2019-10-251-0/+6
| | | | | | | Allows expected behavior when cast to str, also matching behaviour of created instances with those fetched from the DB. Thanks to Simon Charette, Nick Pope, and Shai Berger for reviews.
* Refs #27910 -- Added __init__.py file for model_enums tests.Mariusz Felisiak2019-10-151-0/+0
|
* Fixed #27910 -- Added enumeration helpers for use in Field.choices.Shai Berger2019-09-041-0/+253
These classes can serve as a base class for user enums, supporting translatable human-readable names, or names automatically inferred from the enum member name. Additional properties make it easy to access the list of names, values and display labels. Thanks to the following for ideas and reviews: Carlton Gibson, Fran Hrženjak, Ian Foote, Mariusz Felisiak, Shai Berger. Co-authored-by: Shai Berger <shai@platonix.com> Co-authored-by: Nick Pope <nick.pope@flightdataservices.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>