Opened 5 years ago

Closed 2 years ago

#13735 closed Bug (duplicate)

Broken table layout if content is too large

Reported by: tonnzor Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Normal Keywords:
Cc: tonnzor, <tonn81@…> Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

In ADmin - if content has too much width it doesn't fit into container and filter overlays it.

Please, look at screenshot and complete HTML attached

Attachments (3)

admin_filter.png (40.5 KB) - added by tonnzor 5 years ago.
Screenshot of broken filter block
admin_filter.zip (40.0 KB) - added by tonnzor 5 years ago.
Complete code for error
13735.large-changelist-display-bug.diff (444 bytes) - added by julien 4 years ago.

Download all attachments as: .zip

Change History (11)

Changed 5 years ago by tonnzor

Screenshot of broken filter block

Changed 5 years ago by tonnzor

Complete code for error

comment:1 Changed 5 years ago by SmileyChris

  • milestone 1.3 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by tonnzor

  • Cc tonnzor <tonn81@…> added

comment:3 Changed 4 years ago by julien

I can't seem to be able to reproduce this. Could you provide some source code that we can test?

comment:4 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 4 years ago by julien

  • Easy pickings unset
  • UI/UX unset

See a related issue in #9181.

comment:6 Changed 4 years ago by julien

  • UI/UX set

comment:7 Changed 4 years ago by julien

  • Has patch set
  • Summary changed from Broken filter block to Broken table layout if content is too large

Here's a test case:

# models.py:
from datetime import datetime
from django.db import models

class MyModel(models.Model):
    a = models.CharField(choices=(('draft', 'Draft'), ('published', 'Published')), default='draft', max_length=50)
    b = models.DateTimeField(default=datetime.now)
    c = models.DateTimeField(default=datetime.now)
    d = models.DateTimeField(default=datetime.now)
    e = models.DateTimeField(default=datetime.now)
    f = models.DateTimeField(default=datetime.now)
    g = models.DateTimeField(default=datetime.now)
    h = models.DateTimeField(default=datetime.now)
    i = models.DateTimeField(default=datetime.now)
    j = models.DateTimeField(default=datetime.now)

# admin.py:

from django.contrib import admin

from .models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    list_display = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    list_filter = ['a']

admin.site.register(MyModel, MyModelAdmin)

Note that this is not a problem with the filter but with the results' table itself -- that is, the problem is present whether or not there is a filter. More specifically, the problem comes from the fact that certain types of data (time, date and FK) get a nowrap class, preventing the content of the cell to wrap and adapt to the available width space. See #11447, for example, to see the necessity for that non-wrapping.

I've attached one possible fix making a horizontal bar appear if the table's content can't fit in the page.

Changed 4 years ago by julien

comment:8 Changed 2 years ago by loic84

  • Resolution set to duplicate
  • Status changed from new to closed

Closing in favor of patch in #19972.

Note: See TracTickets for help on using tickets.
Back to Top