mirror of
https://github.com/django/django.git
synced 2025-01-18 14:24:39 +00:00
Refs #34233 -- Used @staticmethod with TextChoices._generate_next_value_().
Now that Python 3.10 is the minimum supported version, we can decorate _generate_next_value_() with @staticmethod. It wasn't possible before as Python < 3.10 does not support calling static methods direct from the class body. https://docs.python.org/3/library/enum.html#enum.Enum._generate_next_value_
This commit is contained in:
parent
e15174983a
commit
170b0a47b0
@ -98,6 +98,7 @@ class IntegerChoices(int, Choices):
|
|||||||
class TextChoices(str, Choices):
|
class TextChoices(str, Choices):
|
||||||
"""Class for creating enumerated string choices."""
|
"""Class for creating enumerated string choices."""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _generate_next_value_(name, start, count, last_values):
|
def _generate_next_value_(name, start, count, last_values):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user