#15291 closed (fixed)
Alignment issue in changelist
Reported by: | Julien Phalip | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This is a different issue than #15290 so I preferred to create a new ticket. This one is quite minor though.
Try this example:
from django.db import models class MyModel(models.Model): name = models.CharField(max_length=100, blank=True) title = models.CharField(max_length=100, blank=True) content = models.CharField(max_length=100, blank=True)
Admin:
from django.contrib import admin from .models import MyModel class MyModelAdmin(admin.ModelAdmin): list_display = ('name', 'title', 'content') actions = None list_display_links = ('title',) admin.site.register(MyModel, MyModelAdmin)
The content of the first column is centered and not left-aligned like all the other columns are. This is dictated by the CSS, presumably because generally the action checkbox is in the first column, and that needs to be centered.
The attached patch fixes this (minor) issue, though there might be other, more general, approaches to this - perhaps by allowing a callable to provide its own classes? For example, in ModelAdmin.action_checkbox
:
def action_checkbox(self, obj): """ A list_display column containing a checkbox widget. """ return helpers.checkbox.render(helpers.ACTION_CHECKBOX_NAME, force_unicode(obj.pk)) action_checkbox.short_description = mark_safe('<input type="checkbox" id="action-toggle" />') action_checkbox.allow_tags = True action_checkbox.css_classes = ['action-checkbox']
Attachments (2)
Change History (6)
by , 14 years ago
Attachment: | 15291_changelist_alignment.diff added |
---|
by , 14 years ago
Attachment: | 15291_changelist_alignment.2.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Fixed tests