
from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin


class BuildCommandResultInline(admin.TabularInline):
    model = BuildCommandResult
    fields = ('command', 'exit_code')


class BuildAdmin(admin.ModelAdmin):
    fields = ('project', 'version', 'type', 'error', 'state', 'success', 'length')
    list_display = ('project', 'success', 'type', 'state', 'date')
    raw_id_fields = ('project', 'version')
    inlines = (BuildCommandResultInline,)


class VersionAdmin(GuardedModelAdmin):
    search_fields = ('slug', 'project__name')
    list_filter = ('project', 'privacy_level')


admin.site.register(Build, BuildAdmin)
admin.site.register(VersionAlias)
admin.site.register(Version, VersionAdmin)


from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin


class BuildCommandResultInline(admin.TabularInline):
    model = BuildCommandResult
    fields = ('command', 'exit_code', 'output')


class BuildAdmin(admin.ModelAdmin):
    fields = ('project', 'version', 'type', 'state', 'error', 'success', 'length')
    list_display = ('project', 'success', 'type', 'state', 'date')
    raw_id_fields = ('project', 'version')
    inlines = (BuildCommandResultInline,)


class VersionAdmin(GuardedModelAdmin):
    search_fields = ('slug', 'project__name')
    list_filter = ('project', 'privacy_level')


admin.site.register(Build, BuildAdmin)
admin.site.register(VersionAlias)
admin.site.register(Version, VersionAdmin)

Include output in result inline
Include output in result inline

  
  from django.contrib import admin
  from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
  from guardian.admin import GuardedModelAdmin
  
  
  class BuildCommandResultInline(admin.TabularInline):
      model = BuildCommandResult
-     fields = ('command', 'exit_code')
+     fields = ('command', 'exit_code', 'output')
  
  
  class BuildAdmin(admin.ModelAdmin):
-     fields = ('project', 'version', 'type', 'error', 'state', 'success', 'length')
+     fields = ('project', 'version', 'type', 'state', 'error', 'success', 'length')
      list_display = ('project', 'success', 'type', 'state', 'date')
      raw_id_fields = ('project', 'version')
      inlines = (BuildCommandResultInline,)
  
  
  class VersionAdmin(GuardedModelAdmin):
      search_fields = ('slug', 'project__name')
      list_filter = ('project', 'privacy_level')
  
  
  admin.site.register(Build, BuildAdmin)
  admin.site.register(VersionAlias)
  admin.site.register(Version, VersionAdmin)
  
Include output in result inline
## Code Before:

from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin


class BuildCommandResultInline(admin.TabularInline):
    model = BuildCommandResult
    fields = ('command', 'exit_code')


class BuildAdmin(admin.ModelAdmin):
    fields = ('project', 'version', 'type', 'error', 'state', 'success', 'length')
    list_display = ('project', 'success', 'type', 'state', 'date')
    raw_id_fields = ('project', 'version')
    inlines = (BuildCommandResultInline,)


class VersionAdmin(GuardedModelAdmin):
    search_fields = ('slug', 'project__name')
    list_filter = ('project', 'privacy_level')


admin.site.register(Build, BuildAdmin)
admin.site.register(VersionAlias)
admin.site.register(Version, VersionAdmin)

## Instruction:
Include output in result inline
## Code After:

from django.contrib import admin
from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult
from guardian.admin import GuardedModelAdmin


class BuildCommandResultInline(admin.TabularInline):
    model = BuildCommandResult
    fields = ('command', 'exit_code', 'output')


class BuildAdmin(admin.ModelAdmin):
    fields = ('project', 'version', 'type', 'state', 'error', 'success', 'length')
    list_display = ('project', 'success', 'type', 'state', 'date')
    raw_id_fields = ('project', 'version')
    inlines = (BuildCommandResultInline,)


class VersionAdmin(GuardedModelAdmin):
    search_fields = ('slug', 'project__name')
    list_filter = ('project', 'privacy_level')


admin.site.register(Build, BuildAdmin)
admin.site.register(VersionAlias)
admin.site.register(Version, VersionAdmin)
