Hello,
I have a question about the use of 'list_filter' in the Django admin:
Is it possible to filter a list of records ('Chapters') of model 'B'
by a field ('language') of model 'A' (to which a ForeignKey field in
model 'B' is referring)?
For example:
-------------------------------------------------------------------
#model 'B'
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.CharField(max_length=100)
language = models.CharField(max_length=30) # << filter
# model 'B'
class Chapter(models.Model):
title = models.CharField(max_length=100)
book = models.ForeignKey(Book)
-------------------------------------------------------------------
Overriding default manager 'objects' seems too rigid, since all
records must be listed when I desire so.
I gave the issue a very slow thought just ago and I wondered: Wouldn't
it be nice if you could specify dedicated managers to be used for a
certain 'list_filter'?
You could then attach an advanced (or not so advanced) manager to each
filter criterion.
Like:
-------------------------------------------------------------------
list_filter = (
('language', {
'english': ('objects_en',),
'french': ('objects_fr',)
}),
)
-------------------------------------------------------------------
Would this make any sense at all?
Maybe newforms-admin already provides hooks for similar functionality.
My initial question and the subsequent proposal diverge a bit. Any
help or comments on either are greatly appreciated. Really!
So long,
Weather
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---