1

このモデル検証エラーが発生する理由がわかりますか?

  • MySQL に「 paypal_transactions 」というレコードを持つテーブルがあります。
  • このプロジェクトを、既存のデータベースを持つ別のコンピューターにコピーしようとしています。

エラーメッセージ:

One or more models did not validate: store.purchase: 'paypal_transaction' has a
relation with model <class 'f3.paypal.models.PaypalPaymentTransactions'>, which 
has either not been installed or is abstract.

ペイパル/models.py

class PaypalPaymentTransactions(models.Model):

    class Meta:
        db_table = 'paypal_transactions'

    payment_id = models.CharField(max_length = 50)
    payer = models.CharField(max_length = 25)
    amount = models.DecimalField(decimal_places = 2, max_digits = 8,
                                 blank = True, default = "0.00")
    currency = models.CharField(max_length = 10)

ストア/models.py

from f3.paypal.models import PaypalPaymentTransactions

class Purchase(models.Model):

    user = models.ForeignKey(User, related_name = 'purchase_user')
    product = models.ForeignKey(Design)
    quantity = models.IntegerField()
    paypal_transaction = models.ForeignKey(
        PaypalPaymentTransactions,
        default = None,
        null = True,
        blank = True)
4

1 に答える 1

2

このエラーは、依存関係の問題が原因で発生する可能性があります。

次のように ForeignKey を使用してみてください。

class Purchase(models.Model):

    user = models.ForeignKey(User, related_name = 'purchase_user')
    product = models.ForeignKey(Design)
    quantity = models.IntegerField()
    paypal_transaction = models.ForeignKey(
        'f3.paypal.PaypalPaymentTransactions',
        default = None,
        null = True,
        blank = True)
于 2013-08-11T13:24:47.727 に答える