Django

Code

Ticket #9969 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

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

Reported by: ramiro Assigned to: ramiro
Milestone: 1.1 Component: django.contrib.admin
Version: SVN Keywords: change list choices columns (None) named groups select dropdown
Cc: sixthgear Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

t9969-r9701.diff (1.3 kB) - added by ramiro on 01/05/09 11:34:07.
Patch thta fixes the issue, no tests yet
t9969-r9708.diff (3.5 kB) - added by ramiro on 01/06/09 17:28:10.
New patch, includes tests
9969-r9891.diff (16.7 kB) - added by ramiro on 02/23/09 19:27:15.
Updated and correct patch
no-hierarchy-no-category-names.png (18.4 kB) - added by ramiro on 02/26/09 09:26:17.
screenshot showing problem with changelist field
list_filter_bug.png (6.8 kB) - added by ramiro on 02/26/09 09:26:43.
screenshot showing problem with list_filter section
9969-admin-bugs-with-nested-choices-r9905.diff (6.4 kB) - added by ramiro on 02/26/09 09:42:21.
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 on 03/31/09 16:36:21.
Patch updated to apply cleanly to trunk as of r10283
9969-backport-to-1.0.x.diff (5.6 kB) - added by ramiro on 04/01/09 15:45:36.
Patch backported to 1.0.X branch

Change History

01/05/09 11:34:07 changed by ramiro

  • attachment t9969-r9701.diff added.

Patch thta fixes the issue, no tests yet

01/05/09 11:34:17 changed by ramiro

  • needs_better_patch changed.
  • has_patch set to 1.
  • needs_tests set to 1.
  • needs_docs changed.

01/06/09 09:44:03 changed by SantiagoZarate

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

Thanks ramiro!

01/06/09 17:22:34 changed by anonymous

  • owner changed from nobody to ramiro.
  • needs_tests deleted.

01/06/09 17:28:10 changed by ramiro

  • attachment t9969-r9708.diff added.

New patch, includes tests

02/23/09 19:27:15 changed by ramiro

  • attachment 9969-r9891.diff added.

Updated and correct patch

02/23/09 19:32:02 changed by anonymous

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]

02/23/09 19:32:55 changed by ramiro

(oops, last comment was mine)

02/26/09 09:21:24 changed by ramiro

  • summary changed from Admin change list view shows (None) instead of the real field value when it has been chosen from a choices named group to Admin changelist table field and list_filter section broken when field value has been chosen from a choices named group.

02/26/09 09:26:17 changed by ramiro

  • attachment no-hierarchy-no-category-names.png added.

screenshot showing problem with changelist field

02/26/09 09:26:43 changed by ramiro

  • attachment list_filter_bug.png added.

screenshot showing problem with list_filter section

02/26/09 09:42:21 changed by ramiro

  • attachment 9969-admin-bugs-with-nested-choices-r9905.diff added.

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

02/26/09 15:57:18 changed by sixthgear

  • cc set to sixthgear.

02/26/09 19:38:17 changed by jacob

  • stage changed from Unreviewed to Accepted.
  • milestone set to 1.1.

03/31/09 16:36:21 changed by ramiro

  • attachment 9969-admin-bugs-with-nested-choices-r10283.diff added.

Patch updated to apply cleanly to trunk as of r10283

03/31/09 16:40:34 changed by Alex

  • stage changed from Accepted to Ready for checkin.

04/01/09 09:19:46 changed by Alex

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r10318.

04/01/09 15:45:36 changed by ramiro

  • attachment 9969-backport-to-1.0.x.diff added.

Patch backported to 1.0.X branch

04/01/09 16:17:57 changed by jacob

(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.


Add/Change #9969 (Admin changelist table field and list_filter section broken when field value has been chosen from a choices named group)




Change Properties
Action