1
我有一個帶有自定義模型的inlineformset。所以它看起來是這樣的:如何使用can_delete = True/False手動呈現inlineformset_factory的Django模板
MyInlineFormSet = inlineformset_factory(MyMainModel, MyInlineModel, form=MyCustomInlineModelForm)
我手工繪製此inlineformset的模板,以便我有超過部件和JavaScript的更多控制。所以,我走在像{% for form in myformset.forms %}
一個循環,並在此頁http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template
該formset具有取決於用戶是否正在創建新對象或編輯現有的can_delete = True
或can_delete = False
上描述的那麼手動呈現每個領域。
問題是,我該如何手動渲染can_delete複選框?
同樣在http://groups.google.com/group使它/ django-users/browse_thread/thread/86def8e3cb40a7bc/ – chefsmart 2010-04-15 17:00:52
另請參閱formset文檔https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-the-formset-in-the-template – 2011-05-30 13:03:55