开发者

Ajax foreign key filter in Django admin interface

开发者 https://www.devze.com 2022-12-27 08:53 出处:网络
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:

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 wha开发者_C百科t 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消