Skip to content

Commit

Permalink
Fix styling of AFE admin interface.
Browse files Browse the repository at this point in the history
The change_list.html for tests used to be handled as a customized
template. The template failed to extend the original change_list.html,
so it didn't keep up to date. Additionally, the "white-space:pre" style
was applied to all <td> elements instead of just the description.

This restricts that style change to the description only, and also
maintains most of the default Django admin interface.

Signed-off-by: James Ren <[email protected]>
  • Loading branch information
James Ren committed Feb 16, 2010
1 parent 972fbdf commit d0ee8c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 46 deletions.
2 changes: 1 addition & 1 deletion frontend/afe/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TestAdmin(SiteAdmin):
'test_time', 'sync_count', 'test_type', 'path',
'dependencies', 'experimental', 'run_verify',
'description')
list_display = ('name', 'test_type', 'description', 'sync_count')
list_display = ('name', 'test_type', 'admin_description', 'sync_count')
search_fields = ('name',)
filter_horizontal = ('dependency_labels',)

Expand Down
7 changes: 7 additions & 0 deletions frontend/afe/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging, os
from datetime import datetime
from django.db import models as dbmodels, connection
from xml.sax import saxutils
import common
from autotest_lib.frontend.afe import model_logic
from autotest_lib.frontend import settings, thread_local
Expand Down Expand Up @@ -422,6 +423,12 @@ class Test(dbmodels.Model, model_logic.ModelExtensions):
objects = model_logic.ExtendedManager()


def admin_description(self):
escaped_description = saxutils.escape(self.description)
return '<span style="white-space:pre">%s</span>' % escaped_description
admin_description.allow_tags = True


class Meta:
db_table = 'afe_autotests'

Expand Down
45 changes: 0 additions & 45 deletions frontend/templates/admin/afe/test/change_list.html

This file was deleted.

0 comments on commit d0ee8c3

Please sign in to comment.