0
這是我的代碼來獲得配方數據在編輯數據從inlineformset_factory丟失
objRecipe = models.Recipe.objects.get(id=recipe_id)
recipe = models.RecipeForm(instance=objRecipe)
objRecipeSteps = models.RecipeStep.objects.filter(recipe__id = objRecipe.id)
recipeSteps = models.RecipeStepFormSet(queryset=objRecipeSteps)
我能夠從「配方」而不是從「recipeSteps」顯示的數據。
這是我的模板代碼
{{ recipeSteps.management_form }}
{% for form in recipeSteps.forms %}
<div class="form-row">
<span class="label">
<span class="step-add"><a href="#">Add</a></span>
<span class="step-remove"><a href="#">Remove</a></span>
</span>
{{ form.recipe_step }}
</div>
{% endfor %}
我找不到任何東西在這裏 http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#inline-formsets