Opened 16 years ago

Closed 15 years ago

Last modified 13 years ago

#9969 closed (fixed)

Admin changelist table field and list_filter section broken when field value has been chosen from a choices named group

Reported by: Ramiro Morales Owned by: Ramiro Morales
Component: contrib.admin Version: dev
Severity: Keywords: change list choices columns (None) named groups select dropdown
Cc: Joshua Cender 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

After [7977], with this setup:

#models.py
from django.db import models

CAT_CHOICES = (
   ('Outer 1', (
           ('option1', 'Inner 1'),
           ('option2', 'Inner 2'),
       )
   ),
  ('normal', 'Normal no nested value'),
)

class Item(models.Model):
    name = models.CharField(max_length=60)
    category = models.CharField("Item Category", max_length=30, choices=CAT_CHOICES)
# admin.py

from t9969.models import Item
from django.contrib import admin

class ItemAdmin(admin.ModelAdmin):
    list_display = ('name', 'category',)

admin.site.register(Item, ItemAdmin)

After adding some Items choosing each of the three available Category field values offered by the select widget, the change list shows None() for the instances with the values 'option1' and 'option2' (should be 'Inner 1' and 'Inner 2' respectively), 'Normal no nested value' shows correctly.

Attachments (8)

t9969-r9701.diff (1.3 KB ) - added by Ramiro Morales 16 years ago.
Patch thta fixes the issue, no tests yet
t9969-r9708.diff (3.5 KB ) - added by Ramiro Morales 16 years ago.
New patch, includes tests
9969-r9891.diff (16.7 KB ) - added by Ramiro Morales 15 years ago.
Updated and correct patch
no-hierarchy-no-category-names.png (18.4 KB ) - added by Ramiro Morales 15 years ago.
screenshot showing problem with changelist field
list_filter_bug.png (6.8 KB ) - added by Ramiro Morales 15 years ago.
screenshot showing problem with list_filter section
9969-admin-bugs-with-nested-choices-r9905.diff (6.4 KB ) - added by Ramiro Morales 15 years ago.
Updated patch includes fixes for poblems in changelist tabel and in filter section, includes tests
9969-admin-bugs-with-nested-choices-r10283.diff (6.2 KB ) - added by Ramiro Morales 15 years ago.
Patch updated to apply cleanly to trunk as of r10283
9969-backport-to-1.0.x.diff (5.6 KB ) - added by Ramiro Morales 15 years ago.
Patch backported to 1.0.X branch

Download all attachments as: .zip

Change History (20)

by Ramiro Morales, 16 years ago

Attachment: t9969-r9701.diff added

Patch thta fixes the issue, no tests yet

comment:1 by Ramiro Morales, 16 years ago

Has patch: set
Needs tests: set

comment:2 by Santiago Zarate, 16 years ago

I've just patched my sistem... works perfectly!

Thanks ramiro!

comment:3 by anonymous, 16 years ago

Needs tests: unset
Owner: changed from nobody to Ramiro Morales

by Ramiro Morales, 16 years ago

Attachment: t9969-r9708.diff added

New patch, includes tests

by Ramiro Morales, 15 years ago

Attachment: 9969-r9891.diff added

Updated and correct patch

comment:4 by anonymous, 15 years ago

I've updated/fixed the patch:

  • The previous patch contained only the regression tests, I've fixed that now by including the actual code fix too.
  • Updated to current trunk status, more specifically the mods to the admin_views regression tests were adapted to post [9739]

comment:5 by Ramiro Morales, 15 years ago

(oops, last comment was mine)

comment:6 by Ramiro Morales, 15 years ago

Summary: Admin change list view shows (None) instead of the real field value when it has been chosen from a choices named groupAdmin changelist table field and list_filter section broken when field value has been chosen from a choices named group

by Ramiro Morales, 15 years ago

screenshot showing problem with changelist field

by Ramiro Morales, 15 years ago

Attachment: list_filter_bug.png added

screenshot showing problem with list_filter section

by Ramiro Morales, 15 years ago

Updated patch includes fixes for poblems in changelist tabel and in filter section, includes tests

comment:7 by Joshua Cender, 15 years ago

Cc: Joshua Cender added

comment:8 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

by Ramiro Morales, 15 years ago

Patch updated to apply cleanly to trunk as of r10283

comment:9 by Alex Gaynor, 15 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Alex Gaynor, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in r10318.

by Ramiro Morales, 15 years ago

Attachment: 9969-backport-to-1.0.x.diff added

Patch backported to 1.0.X branch

comment:11 by Jacob, 15 years ago

(In [10340]) [1.0.X] Fixed #9969: choices with options groups (added in [7977]) now work correctly in the admin with list_display and list_filter. Thanks, ramiro. Backport of r10318 from trunk; thanks, cramm.

comment:12 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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