0

を使用して新しいオブジェクトを保存しています

    new_document = form.save(commit=False)
    new_document.object_id = int(self.kwargs['pk'])
    new_document.content_type = ContentType.objects.get_for_model(self.target_model)
    # Set the document category
    new_document.category = self.get_document_category()
    new_document.save()

ここで知りたいのは、オブジェクトを保存した後、オブジェクトの主キーやその他の属性を取得するにはどうすればよいかということです。

4

1 に答える 1

2

オブジェクトはすでに にありますnew_document

于 2012-10-04T07:24:50.463 に答える