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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:18:44+00:00 2026-06-15T03:18:44+00:00

I’m trying to migrate a few models from one Django app to another and

  • 0

I’m trying to migrate a few models from one Django app to another and based on this question How do I migrate a model out of one django app and into a new one? I’ve got it pretty much worked but when creating the first migration I’m getting this error:

"The model 'contenttype' from the app 'contenttypes' is not available in this migration."

Google and SO doesn’t seem to find any cases for this happening and the aforementioned question doesn’t have anything specific to say about it either, except the comment in the code:

if not db.dry_run:
    # For permissions to work properly after migrating
    orm['contenttypes.contenttype'].objects.filter(app_label='common', model='cat').update(app_label='specific')

Would really appreciate any insight into what am I doing wrong.

Here are the two migration files:

Create:

# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        db.rename_table('cars_country', 'general_country')
        if not db.dry_run:
            # For permissions to work properly after migrating
            orm['contenttypes.ContentType'].objects.filter(app_label='cars', model='country').update(app_label='general')

    def backwards(self, orm):
        pass

Delete:

# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    depends_on = (
        ('general', '0002_create_country'),
    )

    def forwards(self, orm):

        db.alter_column('cars_club', 'country_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['general.Country'], null=True))


    def backwards(self, orm):

        db.rename_table('general_country', 'cars_country')
        db.alter_column('cars_club', 'country_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cars.Country'], null=True))
  • 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-15T03:18:46+00:00Added an answer on June 15, 2026 at 3:18 am

    Ok, found the solution. The freezing notice from dgel got me checking the South documentation and there’s a notice about the ORM migration: This is accomplished by serialising the models into a large dictionary called models at the bottom of every migration. It’s easy to see; it’s the large chunk of dense code at the bottom.

    So basically I just needed to move the orm[‘contenttypes.contenttype] to the second migration file, as the contenttype models dictionary was already there. And now everything seems to work as it should.

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

Sidebar

Related Questions

I am new to PHP trying to migrate from Java to PHP. This question
I'm trying to migrate django apps, and i have problem with one. When i
This has been bugging me for a few days now. I'm trying to migrate
Trying to migrate my app from Rails 3.0 to 3.2 , and as part
I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not
I am trying to migrate data from one table to other. The issue is
I am trying to migrate over to Python from Matlab and can't figure out
Trying to migrate from an old database to a new one in which the
Trying to migrate an app to sandbox and receiving this error on first launch.
Trying to migrate from MSSQL to MySQL. This Stored Proc is creating a temp

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.