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 8234609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:32:21+00:00 2026-06-07T18:32:21+00:00

I have model created field configurated as follows: created = models.DateTimeField(auto_now_add=True) In JSON fixtures

  • 0

I have model created field configurated as follows:

created = models.DateTimeField(auto_now_add=True)

In JSON fixtures I don’t want to declare value for created, but when I try to load fixtures (loadata) I am getting error:

created may not be NULL

So I must provide created value in fixtures or there is an other way?

  • 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-06-07T18:32:23+00:00Added an answer on June 7, 2026 at 6:32 pm

    Try

    import datetime
    created = models.DateTimeField(default=datetime.datetime.now)
    

    And about why this happening you can read over here: Django auto_now and auto_now_add and Django model field default

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

Sidebar

Related Questions

I have a model with a datetime field: class MyModel(models.Model): created = models.DateTimeField(auto_now =
Possible Duplicate: Django models: default value for column I have created a model field
I have a model 'listing' with a field 'created' which is in a datetime
I have a model with SlugField . Value of that field is created when
I have the following models: class Product(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=40, unique=True)
I have user profile model with M2M field class Account(models.Model): ... friends = models.ManyToManyField('self',
I have a Subscription model with a created DateTimeField. The Subscriptions last one year
I have this in my models.py: class AuditableTable(models.Model): class Meta: abstract = True created_by
I have two Django models, roughly summarized by: class Thing(Model): date_created = DateTimeField() class
Suppose I have a model: class SomeModel(models.Model): id = models.AutoField(primary_key=True) a = models.CharField(max_length=10) b

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.