Ajax foreign key filter in Django admin interface
- by Googol
http://blog.philippmetzler.com/?p=52
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 Song(models.Model):
Album = models.ForeignKey(Album)
class Artist(models.Model):
album = models.ForeignKey(Album)
song = models.ForeignKey(Song, blank=True, null=True)
So the user has to define a topic. He can also define a subtopic but doesn’t have to. The subtopic belongs to a topic.
In the admin interface I’d like to limit the choices for subtopic based upon what he selects in topics. 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.
Perhaps it’s another usecase for django-ajax-filtered-fields in general? Or do you know another solution to my specific requirements?