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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:06:00+00:00 2026-06-15T06:06:00+00:00

Previously I had a django model like this class Review(models.Model): reviewdate=models.DateField(default=date.today) description=models.TextField() author=models.ForeignKey(User,null=True) I

  • 0

Previously I had a django model like this

class Review(models.Model):
    reviewdate=models.DateField(default=date.today)
    description=models.TextField()
    author=models.ForeignKey(User,null=True)

I have some 500 records of Review in db.

I added a field to model

from django.core.validators import MinValueValidator,MaxValueValidator

class Review(models.Model):
    reviewdate=models.DateField(default=date.today)
    description=models.TextField()
    author=models.ForeignKey(User,null=True)
    rating= models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)], default=5, help_text='integers 1 to 10')

I ran python manage.py schemamigration myapp --auto successfully ,which created a 0002_auto__add_field_review_rating.py file

Now, I need to do the datamigration for the existing records in db. Do I have to run

python manage.py datamigration myapp somechanges

and then implement the functions in the created somechanges.py ? Since I have already defined in the new field difficulty a default value of 5, will that not be taken when migrate command is run? Do I have to explicitly set it in the somechanges.py functions?

  • 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-15T06:06:01+00:00Added an answer on June 15, 2026 at 6:06 am

    You do not need to do a data migration for this case. As you have specified a default for your new field, that will be used when you apply the schema migration.

    Use the following command to apply the migration:

    ./manage.py migrate myapp
    

    See the advanced changes South tutorial for more information on default values for new fields.

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

Sidebar

Related Questions

I have a class that contains a list of objects. I previously had this
I previously had a post on this issue that was resolved. However since rebuilding
I have an application that uses CoreData. I previously had a class named Marker
I have tried everything and this makes absolutely no sense! I previously had Less.js
I actually previously had a much longer question but I figured this would be
I have previously had python installed because of postfix. I then installed Django. Next,
previously I had : public class PresentationModelConventionScanner : ITypeScanner { public void Process(Type type,
I've been applying Django's automatic administration capabilities to some applications who had previously been
I'm using the Django admin interface to upload images. It had previously worked decently
I previously had ruby 1.9.3-p286 installed with rvm (set as --default ). I had

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.