开发者

Django represent a many-to-many relationship as a CharField

I have a many-to-many field on one of my models and a ModelForm to represent it. I have it in a template but it shows up as a multiple s开发者_JS百科elect field. I need it to show up as a CharField so the user can put in comma-delimited values. Is there any way to do this?


Take a look at the code in django.contrib.admin.widgets.ForeignKeyRawIdWidget to see how the admin's raw_id_fields are implemented and try specifying it as the widgets= kwarg when you define that field on your form.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜