Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

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

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 921919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:56:39+00:00 2026-05-15T18:56:39+00:00

From the official documentation I can’t understand what is default parameter. obj, created =

  • 0

From the official documentation I can’t understand what is default parameter.

obj, created = Person.objects.get_or_create(first_name='John', last_name='Lennon',
                  defaults={'birthday': date(1940, 10, 9)}

Does it mean that it will look for fields which match both John and Lennon parameter and birthday will just insert? Can I use something else instead of defaults?

And what method should I use to clean all fields in table (models)?

It give me FileField error can not resolve keyword default in field

So I need look for fiels, if i found it – update datas. If i didn’t find it I have to crate new field… But, as I understud, It won’t update me default fields when finde present fields.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

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
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:56:40+00:00Added an answer on May 15, 2026 at 6:56 pm

    It’s quite obvious – if get_or_create finds queried object, the defaults keword does nothing. But if it creates object, then instance stored in obj has birthday field (in your example) filled with according value. You can pass any dictionary as defaults, as long as its keys are valid field names for model you’re querying.

    To clean the whole table, you should use something like:

    Model.objects.all().delete()
    

    which is equivalent of:

    DELETE FROM app_model WHERE True;
    

    To set some field in every object ( some column in every row ), there is update() method:

    Model.objects.all().update( some_field = "" )
    

    which translates to:

    UPDATE app_model SET `some_field` = '' WHERE True;
    

    My sql is a bit rusty, but I believe it goes like that, more or less.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 511k
  • Answers 511k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You want to be able to describe asp.net control properties… May 16, 2026 at 5:17 pm
  • Editorial Team
    Editorial Team added an answer select hostname from master..sysprocesses where spid=@@SPID or select host_name from… May 16, 2026 at 5:17 pm
  • Editorial Team
    Editorial Team added an answer The more precise one, is the one with more keys.… May 16, 2026 at 5:17 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I understand from the official documentation on unowned relationships that the app must use
From the official documentation: The reuse identifier is associated with a UITableViewCell object that
The official documentation for TemporaryFile reads: The mode parameter defaults to 'w+b' so that
The official documentation tells me I've to do these 3 things in order to
I dont understand how I can import(I dont know the right terminology, so please
I have been working on an iPhone project, where we created all the user
I followed the official docs on https setup located here: https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html#https-configuration I had to
I need to make a graphic interface in Lazarus from which I run miscelaneous
A site I manage uses the my_twitter.php class simply to receive tweets from one
If so can you provide the code. I am able to do almost everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.