Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Stackorigin – The Community of Question and Answers

Stackorigin – The Community of Question and Answers Logo Stackorigin – The Community of Question and Answers Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
Home/ Questions/Q 9351
Next
Answered
arjun
  • 0
arjun
Asked: August 7, 20212021-08-07T06:15:31+00:00 2021-08-07T06:15:31+00:00In: Programming

What does on_delete do on Django models?

  • 0

What does on_delete do on Django models?

djangomodels
  • 1 1 Answer
  • 27 Views
  • 0 Followers
  • 0
Share
  • Facebook

    Related Questions

    • Django DateTime form widget in forms
    • CharFields must define a 'max_length' attribute in Django
    • Difference between auto_now and auto_now_add-django
    • How to Check Django Database Connection
    • What kind of database's support Django
    • Django TemplateSyntaxError - 'staticfiles' is not a registered tag library
    • difference between 'content' and 'text'
    • object has no attribute 'acquire'
    • Why do we need daemon threads?
    • DeprecationWarning: getName() is deprecated, get the name attribute instead

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. Best Answer
      ashok
      2021-08-07T06:23:30+00:00Added an answer on August 7, 2021 at 6:23 am
      • CASCADE: When the referenced object is deleted, also delete the objects that have references to it (when you remove a blog post for instance, you might want to delete comments as well). SQL equivalent: CASCADE.
      • PROTECT: Forbid the deletion of the referenced object. To delete it you will have to delete all objects that reference it manually. SQL equivalent: RESTRICT.
      • RESTRICT: (introduced in Django 3.1) Similar behavior as PROTECT that matches SQL’s RESTRICT more accurately.
      • SET_NULL: Set the reference to NULL (requires the field to be nullable). For instance, when you delete a User, you might want to keep the comments he posted on blog posts, but say it was posted by an anonymous (or deleted) user. SQL equivalent: SET NULL.
      • SET_DEFAULT: Set the default value. SQL equivalent: SET DEFAULT.
      • SET(...): Set a given value. This one is not part of the SQL standard and is entirely handled by Django.
      • DO_NOTHING: Probably a very bad idea since this would create integrity issues in your database (referencing an object that actually doesn’t exist). SQL equivalent: NO ACTION
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Ask A Question

    Adv 120x600

    Looking for advertising?

    Consider These Things If You Appreciate What stackorigin Does: Stackorigin is a community where you can ask questions and find answers, for free to everyone. We would appreciate it if you bought us a coffee if you liked what we were doing.

    Buy me a Coffe

    Adv 120x600

    • Random
    • Answers
      • On: August 17, 2021
      • Answer: 1

      How to Find Your IP Address on Windows 10

      • On: August 4, 2022
      • Answers: 0

      COD. order Zmax online discount, Zmax n9560 update

      • On: August 8, 2022
      • Answers: 0

      Lasix Monaco, Can you buy lasix over the counter

      • On: August 6, 2022
      • Answers: 0

      Where To Purchase Aldara Austria ?, Aldara after cryotherapy

      • On: August 7, 2022
      • Answers: 0

      Buy Florinef online with echeck, Florinef for

    • hari
      hari added an answer date_sortie = forms.DateField(label='Release year',required=False, widget=forms.SelectDateWidget) January 29, 2023 at 4:50 pm
    • hari
      hari added an answer auto_now it updates field each time, while auto_now_add updates on creation… January 29, 2023 at 5:46 am
    • hari
      hari added an answer r.text is the content of the response in Unicode, and r.content is… January 27, 2023 at 4:33 pm
    • sam
      sam added an answer You can't get a new one except after the rest.… January 6, 2023 at 10:37 am
    • sam
      sam added an answer The order is Try, Except, Else should get   January 6, 2023 at 9:28 am

    Adv 120x600

    Trending Categories

    Health
    2031Questions
    , 4Followers
    Programming
    1186Questions
    , 0Followers
    Technology
    216Questions
    , 3Followers
    General Knowledge
    131Questions
    , 0Followers
    Business & Finance
    84Questions
    , 4Followers

    Adv 120×600

    Stats

    • Questions 4k
    • Answers 1k
    • Best Answers 105
    • Users 100

    Users

    niyadas823

    niyadas823

    • 0 Questions
    • 0 Answers
    nirala3

    nirala3

    • 2 Questions
    • 0 Answers
    Perrywalton

    Perrywalton

    • 1 Question
    • 0 Answers
    veeraa

    veeraa

    • 0 Questions
    • 0 Answers
    Stewesmitz

    Stewesmitz

    • 0 Questions
    • 0 Answers

    Adv 120×600

    Explore

    • Recent Questions
    • Most Answered
    • Answers
    • No Answers
    • Most Visited
    • Most Voted
    • Random
    • Polls

    Footer

    Stackorigin - The Community of Question and Answers

    Stackorigin

    Stackorigin is the world’s largest Q&A networking site, Stackorigin community brings you the collaboration of all the various Questions and the related Answers given by the community.

    About

    • About Us
    • Contact Us
    • FAQ
    • Submit Guest Post Article on Technology, Education, Health, Apps, Gadgets, IoT, AI, Business, Digital Marketing and More

    Info

    • Privacy Policy
    • Terms and Conditions
    • Community Guidelines
    • Tags

    Products

    • Tutorials
    • Advertising
    • Categories
    • Corona
    • StackHow

    Follow

    © 2022 Stackorigin. All Rights Reserved.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.