#16714: Can't list_filter across a relationship on a SmallIntegerField
----------------------+-------------------------------
Reporter: Clueless | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: contrib.admin
Version: 1.3 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------+-------------------------------
If you have a SmallIntegerField on a model that is related via a foreign
key then you can't use that field as an option in list_filter. Doing so
gives you the correct distinct options in the list page sidebar, but if
you try to select any of them you receive a 302 redirect to /?e=1, as if
you had used an unexpected query-string parameter.
Here's a small example to try yourself:
{{{
# models.py
from django.db import models
class Rel(models.Model):
year = models.SmallIntegerField(default=2010)
class Src(models.Model):
rel = models.ForeignKey(Rel)
# admin.py
from models import Rel, Src
from django.contrib import admin
class RelAdmin(admin.ModelAdmin):
model = Rel
list_filter = ('year',)
admin.site.register(Rel, RelAdmin)
class SrcAdmin(admin.ModelAdmin):
model = Src
list_filter = ('rel__year',)
admin.site.register(Src, SrcAdmin)
}}}
I'm running Django 1.3, MySQL 5.5, on Arch Linux.
--
Ticket URL: <https://code.djangoproject.com/ticket/16714>
Django <https://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.