-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add correct verbose_name and verbose_name_plural to Audio, DeletedAudio, and SensitiveAudio models #4986
base: main
Are you sure you want to change the base?
Conversation
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.
This is looking good. For tests to pass you just need to generate and include the migrations associated to these changes that Django creates. Run the following and commit the changes:
ov just api/dj makemigration
ov just api/dj migrate
The migration would be no-op, you can check doing ov just api/dj sqlmigrate api 0071
, but they are still required.
Expected output
BEGIN;
--
-- Change Meta options on audio
--
-- (no-op)
--
-- Change Meta options on deletedaudio
--
-- (no-op)
--
-- Change Meta options on sensitiveaudio
--
-- (no-op)
COMMIT;
docker/es/env.docker
Outdated
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.
This Change can fix issue #4974
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.
The overall fix required broader changes, which I've got in this PR: #4992
You can rebase this PR on that one, or wait for that one to be merged (hopefully it will go in soon given the criticality of it to the development environment).
Hi @krysal, |
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.
This LGTM, I'll go ahead and removed the change to the env.docker file in favour of #4992 which has a broader fix and then merge.
operations = [ | ||
migrations.AlterModelOptions( | ||
name='audio', | ||
options={'ordering': ['-created_on'], 'verbose_name': 'audio track', 'verbose_name_plural': 'audio tracks'}, |
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 wonder what introduced this ordering change? 🤔 And why it wasn't present before. Image has had it since migration 0.
…io, and SensitiveAudio models
…io, and SensitiveAudio models (WordPress#4655)
…io, and SensitiveAudio models (WordPress#4655)
…io, and SensitiveAudio models (WordPress#4655)
…io, and SensitiveAudio models (WordPress#4655)
fcba8b3
to
0c03248
Compare
@dryruffian I've rebased your branch to try to fix that failing API test. |
~@dhruvkb would you be able to lend a hand with debugging why the permission group might not be available in load_sample_data? I can't make out any reason why this PR should have any effect on that 🤔 ~ Never mind! @dryruffian you'll need to update the In fact, however, I am worried that this will break existing permissions in production. @dhruvkb can you help review this and see whether it will cause a problem downstream if we change the verbose name of the model? IIRC we have code that manually builds the permission checks in the media moderation admin. |
Thanks @sarayourfriend, |
…io, and SensitiveAudio models (WordPress#4655)
…io, and SensitiveAudio models (WordPress#4655)
…io, and SensitiveAudio models (WordPress#4655)
Hi @sarayourfriend, |
Yes, as I said, because this PR changes the name of the model, the name of the permission is no longer the same as it was before. We can fix this by using a part of the permission object that is constant, the diff --git a/load_sample_data.sh b/load_sample_data.sh
index cd5f195a3..a67d3b4c4 100755
--- a/load_sample_data.sh
+++ b/load_sample_data.sh
@@ -101,9 +101,9 @@ if created:
print('Setting up Content Moderators group')
for model, perms in model_perms_map.items():
for perm in perms:
- name = f'Can {crud_perm_map[perm]} {model}'
+ name = f'{crud_perm_map[perm]}_{model}'
print(f'Adding permission to moderators group: {name}')
- model_add_perm = Permission.objects.get(name=name)
+ model_add_perm = Permission.objects.get(codename=name)
mod_group.permissions.add(model_add_perm)
mod_group.save()
mod_group.user_set.add(User.objects.get(username='moderator')) |
You can ignore the failure on the migration safety warning; it will not complete on forks. It isn't a required request, so don't worry about it, it won't block merging the PR. |
…io, and SensitiveAudio models (WordPress#4655
Hi @dhruvkb, I've fixed all the tests in this PR. Please review my changes and let me know if you have any further suggestions. |
Fixes
Fixes #4655 by @dhruvkb
Description
This PR addresses the issue of missing or incorrect
verbose_name
andverbose_name_plural
values for audio-related models. The changes improve the Django admin interface experience by providing more accurate and consistent labeling for these models, as specified in the issue description.Checklist
Update index.md
).main
) or a parent feature branch.ov just catalog/generate-docs
for catalogPRs) or the media properties generator (
ov just catalog/generate-docs media-props
for the catalog or
ov just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin