#15291: Alignment issue in changelist
----------------------------------+-----------------------------------------
Reporter: julien | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.2
Keywords: | Triage Stage: Unreviewed
Has patch: 1 |
----------------------------------+-----------------------------------------
This is a different issue than #15290 so I preferred to create a new
ticket. This one is quite minor though.
Try this example:
{{{
#!python
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:
{{{
#!python
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`:
{{{
#!python
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']
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/15291>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.