开发者

How to manually render a Django template for an inlineformset_factory with can_delete = True / False

I have an inlineformset with a custom Modelform. So it looks something like this:

MyInlineFormSet = inlineformset_factory(MyMainModel, MyInlineModel, form=MyCustomInlineModelForm)

I am rendering this inlineformset manually in a template so that I have more control over widgets and javascript. So I go in a loop like {% for form in myformset.forms %} and then manually render each field as described on this page http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template

The formset has c开发者_开发知识库an_delete = True or can_delete = False depending on whether the user is creating new objects or editing existing ones.

Question is, how do I manually render the can_delete checkbox?


inlineformset_factory marks can_delete=True, and I don't know if you can change it, but, you can render it with "form.DELETE"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜