Skip to content

Clean up build admin to make list display match search #7028

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
May 6, 2020
Merged
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
17 changes: 12 additions & 5 deletions readthedocs/builds/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,22 @@ class BuildAdmin(admin.ModelAdmin):
'state',
'error',
'success',
'length',
'cold_storage',
'date',
'builder',
'length',
'pretty_config',
)
readonly_fields = (
'date', # required to be read-only because it's a @property
'pretty_config', # required to be read-only because it's a @property
'builder',
'length',
)
list_display = (
'id',
'project',
'version_name',
'project_slug',
'version_slug',
'success',
'type',
'state',
Expand All @@ -86,8 +90,11 @@ class BuildAdmin(admin.ModelAdmin):
inlines = (BuildCommandResultInline,)
search_fields = ('project__slug', 'version__slug')

def version_name(self, obj):
return obj.version.verbose_name
def project_slug(self, obj):
return obj.project.slug

def version_slug(self, obj):
return obj.version.slug

def pretty_config(self, instance):
return _pretty_config(instance)
Expand Down