Django 管理界面中的 Ajax 外键过滤器
http://blog.philippmetzler.com/?p=52
刚刚尝试过 django-ajax -filtered-fields 非常喜欢它。我正在寻找这个问题的解决方案:
我的模型如下所示:
class Song(models.Model): 专辑 = models.ForeignKey(Album)
类 Artist(models.Model): 专辑 = models.ForeignKey(专辑) Song = models.ForeignKey(Song, Blank=True, null=True)
因此用户必须定义一个主题。他还可以定义一个子主题,但不是必须的。子主题属于一个主题。
在管理界面中,我想根据他在主题中选择的内容来限制子主题的选择。这应该通过 AJAX 动态改变。我将仔细研究 django-ajax-filtered-fields 但没有找到该特定问题的解决方案。
也许这是 django-ajax-filtered-fields 的另一个用例?或者您知道满足我的具体要求的另一种解决方案吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论