开发者

Django: Why when using auto-populate from a manytomany or foreignkey field I always get the ID?

I have a slug field that I would like to be auto-populated from a value in a many开发者_运维问答tomany. It kind of works as it displays in realtime the ID of the selection in the manytomany field. The model of the manytomany field has its own def unicode(self) to return a string value with its name but this doesnt appear in the slug.


Django's populate javascript always just uses the value attribute of the coresponding HTML field, which is always the id, it it is a select, no matter how you change your python code! You will need to make a custom js to achieve what you are trying to do!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜