I have a problem deleting 2 foreign keys from a foreign key. I'll explain better:
This is the credit card model hierarchy I have:
- CreditCard
-
- Customer
-
-
- Address
-
-
-
- Phone
-
I'm trying to delete the address and phone, then customer and creditcard. You are saying that I can not change the foreign key address and phone from the customer model to null.
(1048, "Column 'phone_id' cannot be null")
He is trying to do an update on the phone_id and address_id column by setting to NULL. The mistake was this, the operation is not allowed. It then assigns null=True, blank=True
to the customer model and the error continues.
I tried this way:
_credit_card.customer.phone.delete()
_credit_card.customer.address.delete()
_credit_card.customer.delete()
_credit_card.delete()
Python 3, Django 1.10