Ajax foreign key filter in Django admin interface

Posted by Googol on Stack Overflow See other posts from Stack Overflow or by Googol
Published on 2010-04-14T11:37:44Z Indexed on 2010/04/14 11:43 UTC
Read the original article Hit count: 271

Filed under:

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?

© Stack Overflow or respective owner

Related posts about django-admin