Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow text choices being directly assigned as choices. #261

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions django-stubs/db/models/fields/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from typing_extensions import Literal, Self

from django.core.checks import CheckMessage
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
from django.db.models import Model
from django.db.models import Model, TextChoices
from django.db.models.expressions import Col, Combinable
from django.db.models.query_utils import RegisterLookupMixin
from django.forms import Widget
Expand Down Expand Up @@ -679,7 +679,8 @@ class CharField(Generic[_C], Field[_C | Combinable, _C]):
unique_for_date: str | None = ...,
unique_for_month: str | None = ...,
unique_for_year: str | None = ...,
choices: Iterable[tuple[_C, str] | tuple[str, Iterable[tuple[_C, str]]]] = ...,
choices: Iterable[tuple[_C, str] | tuple[str, Iterable[tuple[_C, str]]]]
| type[TextChoices] = ...,
help_text: str = ...,
db_column: str | None = ...,
db_comment: str | None = ...,
Expand All @@ -706,7 +707,8 @@ class CharField(Generic[_C], Field[_C | Combinable, _C]):
unique_for_date: str | None = ...,
unique_for_month: str | None = ...,
unique_for_year: str | None = ...,
choices: Iterable[tuple[_C, str] | tuple[str, Iterable[tuple[_C, str]]]] = ...,
choices: Iterable[tuple[_C, str] | tuple[str, Iterable[tuple[_C, str]]]]
| type[TextChoices] = ...,
help_text: str = ...,
db_column: str | None = ...,
db_comment: str | None = ...,
Expand Down
Loading