Django测试管理表单内联

时间:2018-05-03 09:54:21

标签: django forms testing admin inlines

我有一份工作表的管理表格。 要查看该优惠的所有工作回复,我的表单如下所示:

class JobOfferAdminDisplayable(BaseTranslationModelAdmin):

    model = JobOffer
    inlines = [JobResponseInline,]

class JobResponseInline(TabularDynamicInlineAdmin):

    model = JobResponse

但我不知道如何测试它...试图在查询后包含模型的属性+管理表格数据,但它不起作用

response = self.client.post(self.url, {"title_fr" : 'title', 'form-TOTAL_FORMS': '2', 'form-INITIAL_FORMS': '1',"form-MAX_NUM_FORMS" : '2', "status" : 2, "email" :'email@email.fr', "type":'internship'})

此查询会生成以下错误:

django.core.exceptions.ValidationError: ['ManagementForm data is missing or has been tampered with']

0 个答案:

没有答案