#8292 closed (fixed)
InlineModelAdmin not honoring filter_horizontal
Reported by: | David A Krauth | Owned by: | Brian Rosner |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
One would expect the filter_horizontal
/ filter_vertical
admin options to
function with the InlineModelAdmin
classes for generic relationships
in contenttypes.generic
.
Considering the code snippet below, I would have expected the nice javascript
dual-picklist interface instead of the plain, single multiselect input.
Sample models.py file:
from django.db import models from django.contrib.auth.models import User from django.contrib import admin from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType class GenericDocument(models.Model): title = models.CharField(max_length=100) authors = models.ManyToManyField(User, blank=True) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() class Publisher(models.Model): name = models.CharField(max_length=50) articles = generic.GenericRelation(GenericDocument) class GenericDocumentInline(generic.GenericStackedInline): model = GenericDocument filter_horizontal = ('authors', ) class PublisherAdmin(admin.ModelAdmin): list_display = ('name', ) inlines = [GenericDocumentInline] admin.site.register(Publisher, PublisherAdmin)
Change History (7)
comment:1 by , 16 years ago
milestone: | → post-1.0 |
---|---|
Triage Stage: | Unreviewed → Someday/Maybe |
comment:2 by , 16 years ago
Component: | Uncategorized → Admin interface |
---|
comment:3 by , 16 years ago
milestone: | post-1.0 → 1.0 |
---|---|
Triage Stage: | Someday/Maybe → Accepted |
Hmm ... I see Brian considers this possible in scope for 1.0, so I'll leave it up to him to decide if we can get it done in time. Recategorising on those grounds.
comment:4 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Summary: | GenericInlineModelAdmin not honoring filter_horizontal → InlineModelAdmin not honoring filter_horizontal |
It turns out this is bit more than specially generic inlines. It applies to all inlines. Adjusting title to reflect that.
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 16 years ago
I've a similiar model but instead of:
articles = generic.GenericRelation(GenericDocument)
I've:
articles = models.ForeignKey(Document)
and instead of:
class GenericDocumentInline(generic.GenericStackedInline):
I've:
class DocumentInline(admin.StackedInline):
Is there a way to get the javascript dual-picklist interface for authors through a ForeignKey?
Thanks.
Generic relations are normal fields on a number of levels and expecting them to be drop in replacements everywhere is a little optimistic. So it's not really "one would expect" as much as "one might hope this will work in the future". Postponing this to post-1.0, since it will be fully backwards compatible to add it then and too much work to do so right now.