We have a solution to the problem now! So first the solution and then the problem:
http://github.com/digi604/django-smart-selects
The problem:
http://code.google.com/p/django-ajax-filtered-fields/
Just tried django-ajax-filtered-fields and like it very much. I’m looking for a solution for this problem:
My model looks like this:
class Artist(models.Model):
class Song(models.Model):
artist = models.ForeignKey(Artist)
album = models.ForeignKey(Album, blank=True, null=True)
class Album(models.Model):
artist = models.ForeignKey(Artist)
So the user has to define an an artist when adding a song. He can also define an album but doesn’t have to. The album belongs to an artist.
In the Django admin interface I’d like to limit the choices for albums based upon what he selects in the field “artist”. That should change dynamically with AJAX. I will have a closer look to django-ajax-filtered-fields but didn’t find a solution to that specific problem. Are there plans to include such functionality in the Django admin interface?
The ajax filter should work with more than two levels also. For instance if there is an additional class like
class RecordLabel(models.Model):
artist = models.ForeignKey(Artist)
So if i select a record label the choices for artist should be filtered based upon the selected record label the artist is signed to.
Perhaps it’s another usecase for django-ajax-filtered-fields in general? Or do you know another solution to my specific requirements?
Discussion in the Django developers group: http://groups.google.com/group/django-developers/browse_thread/thread/daa3bcdfa247c2ed
http://github.com/alex/django-filter
Django-filter is a reusable Django application for allowing users to filter queryset dynamically. But it seems not to be suitable for the admin interface.

