summaryrefslogtreecommitdiff
path: root/tests/model_enums
AgeCommit message (Collapse)Author
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-04-07Refs #32074 -- Backported Enum.__repr__() from Python 3.10.Mariusz Felisiak
Enum.__repr__() was changed in [1], we should use the same format in Python < 3.10. [1] https://bugs.python.org/issue40066
2021-03-24Fixed #32460 -- Allowed "label"/"do_not_call_in_templates" members in model ↵Nick Pope
choice enums.
2021-03-24Refs #32460 -- Doc'd and tested that property names of model choice enums ↵Nick Pope
cannot be used as members.
2020-01-10Fixed #31154 -- Added support for using enumeration types in templates.Adam Johnson
Enumeration helpers are callables, so the template system tried to call them with no arguments. Thanks Rupert Baker for helping discover this.
2019-10-29Used more specific unittest assertions in tests.Nick Pope
* 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.
2019-10-25Fixed #30902 -- Added __str__() for model choice enums.Carlton Gibson
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.
2019-10-15Refs #27910 -- Added __init__.py file for model_enums tests.Mariusz Felisiak
2019-09-04Fixed #27910 -- Added enumeration helpers for use in Field.choices.Shai Berger
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>