-
-
Notifications
You must be signed in to change notification settings - Fork 454
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 Promise to be passed to ArrayField.verbose_name #1168
Allow Promise to be passed to ArrayField.verbose_name #1168
Conversation
@@ -27,7 +27,7 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): | |||
base_field: Field, | |||
size: Optional[int] = ..., | |||
*, | |||
verbose_name: Optional[Union[str, bytes]] = ..., | |||
verbose_name: Optional[Union[_StrOrPromise, bytes]] = ..., | |||
name: Optional[str] = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should name also accept _StrOrPromise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aight, updated that as well
@@ -27,7 +27,7 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): | |||
base_field: Field, | |||
size: Optional[int] = ..., | |||
*, | |||
verbose_name: Optional[Union[str, bytes]] = ..., | |||
verbose_name: Optional[Union[_StrOrPromise, bytes]] = ..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really in the scope of this PR, but I can't help to ask, why is bytes
even allowed here? Makes no sense IMO. Is this for Python 2 compatibility?
The commit message adding this simply states "fixes" d43cb1f (?!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be some legacy thing, I am totally fine with removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I can open a PR for that after this is merged, if ljodal doesn't get to it first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the bytes while fixing name
:)
Thanks! |
Hrm. The And I think it doesn't makes sense for |
Oh, oops, guess we should revert that bit then 😬 |
This was incorrectly changed in typeddjango#1168, so reverting that change.
This was incorrectly changed in #1168, so reverting that change.
This expands the interface of ArrayField to allow lazy translations to be passed to the verbose_name field. Seems like this was missed in #1139