“Foreignkey on Delete Django” Kode Jawaban

Django Lapangan Kunci Asing di Delete Do Nothing

from django.db import models

class Car(models.Model):
    manufacturer = models.ForeignKey('Manufacturer',on_delete=models.DO_NOTHING,)

class Manufacturer(models.Model):
    pass
Trained Tuna

Foreignkey on Delete Django

When an object referenced by a ForeignKey is deleted, 
Django will emulate the behavior of the SQL constraint 
specified by the on_delete argument.

Options: 
1. CASCADE
2. PROTECT
3. RESTRICT
4. SET_NULL
5. SET_DEFAULT
6. SET(...)
7. DO_NOTHING
Foolish Flatworm

Jawaban yang mirip dengan “Foreignkey on Delete Django”

Pertanyaan yang mirip dengan “Foreignkey on Delete Django”

Lebih banyak jawaban terkait untuk “Foreignkey on Delete Django” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya