Skip to content

Implemented Verbose Name Translation for TokenProxy #8713

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

Merged
merged 1 commit into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.3 on 2022-11-24 21:07

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('authtoken', '0003_tokenproxy'),
]

operations = [
migrations.AlterModelOptions(
name='tokenproxy',
options={'verbose_name': 'Token', 'verbose_name_plural': 'Tokens'},
),
]
3 changes: 2 additions & 1 deletion rest_framework/authtoken/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ def pk(self):
class Meta:
proxy = 'rest_framework.authtoken' in settings.INSTALLED_APPS
abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS
verbose_name = "token"
verbose_name = _("Token")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to make sure, adding this two lines with modified values, is there any possible missing migrations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand it, no. Migrations only accept hard coded values, but since this is not one, a migration would not make sense. It must be created when the language is set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the TokenProxy model is inheriting from https://github.com/encode/django-rest-framework/blob/master/rest_framework/authtoken/models.py#L27 but still not showing it properly, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the migrations history https://github.com/encode/django-rest-framework/tree/master/rest_framework/authtoken/migrations it would be safer to check locally if new migrations are generated with this two attribute changes in meta. if not it is OK. but if so, we must have to ship it with the package :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding the missing auto migration

verbose_name_plural = _("Tokens")