1

コードに e コマースを統合します。そして、製品に問題が発生します。models.pyシンプルに更新するとき

class MyProduct(AbstractProduct):
    pass

またはPackage、AbstractProduct を使用してモデルを拡張し、移行を作成しようとすると、次のエラーが表示されます。

catalogue.Product.product_class: (fields.E304) Reverse accessor for 'Product.product_class' clashes with reverse accessor for 'Package.product_class'.
    HINT: Add or change a related_name argument to the definition for 'Product.product_class' or 'Package.product_class'.
catalogue.Product.product_class: (fields.E305) Reverse query name for 'Product.product_class' clashes with reverse query name for 'Package.product_class'.
    HINT: Add or change a related_name argument to the definition for 'Product.product_class' or 'Package.product_class'.
catalogue.ProductAttributeValue: (fields.E336) The model is used as an intermediate model by 'ckanwrap.Package.attributes', but it does not have a foreign key to 'Package' or 'ProductAttribute'.
catalogue.ProductCategory: (fields.E336) The model is used as an intermediate model by 'ckanwrap.Package.categories', but it does not have a foreign key to 'Package' or 'Category'.
catalogue.ProductRecommendation: (fields.E336) The model is used as an intermediate model by 'ckanwrap.Package.recommended_products', but it does not have a foreign key to 'Package' or 'Product'.
ckanwrap.Package.product_class: (fields.E304) Reverse accessor for 'Package.product_class' clashes with reverse accessor for 'Product.product_class'.
    HINT: Add or change a related_name argument to the definition for 'Package.product_class' or 'Product.product_class'.
ckanwrap.Package.product_class: (fields.E305) Reverse query name for 'Package.product_class' clashes with reverse query name for 'Product.product_class'.
    HINT: Add or change a related_name argument to the definition for 'Package.product_class' or 'Product.product_class'.
ckanwrap.Package.recommended_products: (fields.E335) The model is used as an intermediate model by 'ckanwrap.Package.recommended_products', but it has more than one foreign key to 'Product', which is ambiguous. You must specify which foreign key Django should use via the through_fields keyword argument.
    HINT: If you want to create a recursive relationship, use ForeignKey("self", symmetrical=False, through="ProductRecommendation").

助言がありますか?

4

1 に答える 1