私は次のモデルを持っています:
class ProjectBudget(models.Model):
フォームとインラインがあります。
class ProjectBudgetAdmin(admin.ModelAdmin):
form = ProjectBudgetForm
inlines= [ProjectSpentsInline]
class ProjectSpentsInline(admin.TabularInline):
model = ProjectSpents
フォームにフィールドがありますfile
。このファイルから、インラインオブジェクトProjectSpents
の値を入力したい:
class ProjectBudgetForm(ModelForm):
file = forms.FileField
def clean_file(self):
parse file then populate inline model objects ProjectSpents....
問題は、clean_file から ProjectSpents のインライン値を編集したいということですが、clean_file の前にクエリセットが既にいっぱいになっていて、新しいインライン値が表示されないため、問題があります。多分別の解決策がありますか?