Skip to content
Snippets Groups Projects
Commit 6213a650 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'fast-worker-admin' into 'master'

Faster worker admin

Closes #689

See merge request !1284
parents fdf77b05 d49b2000
No related branches found
No related tags found
1 merge request!1284Faster worker admin
......@@ -71,7 +71,18 @@ class RepositoryAdmin(admin.ModelAdmin):
class WorkerVersionInline(admin.StackedInline):
show_change_link = True
model = WorkerVersion
fields = ('revision', 'state', 'configuration', 'docker_image_id')
readonly_fields = ('revision', 'state', 'configuration', 'docker_image_id')
def get_queryset(self, *args, **kwargs):
"""
Prefetch worker and revision as they are used in versions inline labels.
Using a proxy model to override `__str__` is possible but removes the Change link
as the model does not appear as registered.
"""
return super().get_queryset(*args, **kwargs).prefetch_related('worker', 'revision')
class WorkerAdmin(admin.ModelAdmin):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment