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

  • Home
  • SEARCH
  • 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 524337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:33:28+00:00 2026-05-13T08:33:28+00:00

I created a Django app that had its own internal voting system and a

  • 0

I created a Django app that had its own internal voting system and a model called Vote to track it. I want to refactor the voting system into its own app so I can reuse it. However, the original app is in production and I need to create a data migration that will take all the Votes and transplant them into the separate app.

How can I get two apps to participate in a migration so that I have access to both their models? Unfortunately, the original and separate apps both have a model named Vote now, so I need to be aware of any conflicts.

  • 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-13T08:33:28+00:00Added an answer on May 13, 2026 at 8:33 am

    Have you tried db.rename_table?

    I would start by creating a migration in either the new or old app that looks something like this.

    class Migration:
    
        def forwards(self, orm):
            db.rename_table('old_vote', 'new_vote')    
    
        def backwards(self, orm):
            db.rename_table('new_vote', 'old_vote')
    

    If that does not work you can migrate each item in a loop with something along these lines:

    def forwards(self, orm):
        for old in orm['old.vote'].objects.all():
            # create a new.Vote with old's data
    models = {
        'old.vote' = { ... },
        'new.vote' = { ... },
    }
    

    Note: You must use orm[...] to access any models outside the app currently being migrated. Otherwise, standard orm.Vote.objects.all() notation works.

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

Sidebar

Related Questions

So, I have created a django app here: http://fpaste.org/bkFf/ without using django-admin. I want
I've created a basic Django app that contains books/authors/publishers as per the Django Book
I created a virtualenv in my django app folder, and there I installed all
I created a textmate project for a django app I'm working on, and I
I've recently created a site with a django app hosted by webfaction. In general,
I create a new Django app (not project) called Bussinesses, then add following class
So I have a django project I just created called 'coolprojectsite' the directory structure
I created the models in a Django app using manage.py inspectdb on an existing
I am creating a Django app and want to have visualizations of a social
I'm trying to store sections of a document in a Django app. The model

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.