-
Notifications
You must be signed in to change notification settings - Fork 548
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
Cloud images - support duplicated names #3467
Cloud images - support duplicated names #3467
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.
Left several comments inline.
src/ralph/virtual/admin.py
Outdated
@@ -514,7 +514,7 @@ class CloudProviderAdmin(RalphAdmin): | |||
@register(CloudImage) | |||
class CloudImageAdmin(RalphAdmin): | |||
list_display = ['name', 'image_id'] | |||
list_filter = ['name', 'image_id'] | |||
list_filter = ['image_id'] |
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.
After giving it a thought I think it's actually better to leave the name here and get rid of the uuid -- I can imagine someone recalling a part of the image name and trying to filter by that, however, remembering an image uuid is unlikely.
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.
Another point is that it would be useful to enable API filtering by both name and uuid fields. API filters are defined on view sets and by default are copied from admin. So in this case it's necessary to add a list_filter
property to CloudImageViewSet
. Here you can find an example: https://github.com/allegro/ralph/blob/ng/src/ralph/virtual/api.py#L181
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.
Done.
@@ -16,13 +16,9 @@ class Migration(migrations.Migration): | |||
name='CloudImage', |
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.
You cannot change already merged migrations -- they are already applied somewhere. Just generate a new one.
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.
Done.
1c0a169
to
a681457
Compare
a681457
to
faf0b80
Compare
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.
LGTM, thanks!
No description provided.